Skip to content

Commit 575663c

Browse files
Merge pull request #156 from tidymodels/hardh-check
add hard R cmd check
2 parents cc7c410 + db66b23 commit 575663c

33 files changed

+186
-108
lines changed
+59
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
# Workflow derived from https://github.com/r-lib/actions/tree/v2/examples
2+
# Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help
3+
#
4+
# NOTE: This workflow only directly installs "hard" dependencies, i.e. Depends,
5+
# Imports, and LinkingTo dependencies. Notably, Suggests dependencies are never
6+
# installed, with the exception of testthat, knitr, and rmarkdown. The cache is
7+
# never used to avoid accidentally restoring a cache containing a suggested
8+
# dependency.
9+
on:
10+
push:
11+
branches: [main, master]
12+
pull_request:
13+
14+
name: R-CMD-check-hard.yaml
15+
16+
permissions: read-all
17+
18+
jobs:
19+
check-no-suggests:
20+
runs-on: ${{ matrix.config.os }}
21+
22+
name: ${{ matrix.config.os }} (${{ matrix.config.r }})
23+
24+
strategy:
25+
fail-fast: false
26+
matrix:
27+
config:
28+
- {os: ubuntu-latest, r: 'release'}
29+
30+
env:
31+
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
32+
R_KEEP_PKG_SOURCE: yes
33+
34+
steps:
35+
- uses: actions/checkout@v4
36+
37+
- uses: r-lib/actions/setup-pandoc@v2
38+
39+
- uses: r-lib/actions/setup-r@v2
40+
with:
41+
r-version: ${{ matrix.config.r }}
42+
http-user-agent: ${{ matrix.config.http-user-agent }}
43+
use-public-rspm: true
44+
45+
- uses: r-lib/actions/setup-r-dependencies@v2
46+
with:
47+
dependencies: '"hard"'
48+
cache: false
49+
extra-packages: |
50+
any::rcmdcheck
51+
any::testthat
52+
any::knitr
53+
any::rmarkdown
54+
needs: check
55+
56+
- uses: r-lib/actions/check-r-package@v2
57+
with:
58+
upload-snapshots: true
59+
build_args: 'c("--no-manual","--compact-vignettes=gs+qpdf")'

R/adasyn.R

+1-1
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@
6060
#' @family Steps for over-sampling
6161
#'
6262
#' @export
63-
#' @examples
63+
#' @examplesIf rlang::is_installed("modeldata")
6464
#' library(recipes)
6565
#' library(modeldata)
6666
#' data(hpc_data)

R/bsmote.R

+1-1
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@
8282
#' @family Steps for over-sampling
8383
#'
8484
#' @export
85-
#' @examples
85+
#' @examplesIf rlang::is_installed("modeldata")
8686
#' library(recipes)
8787
#' library(modeldata)
8888
#' data(hpc_data)

R/downsample.R

+1-1
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@
7070
#' @family Steps for under-sampling
7171
#'
7272
#' @export
73-
#' @examples
73+
#' @examplesIf rlang::is_installed("modeldata")
7474
#' library(recipes)
7575
#' library(modeldata)
7676
#' data(hpc_data)

R/nearmiss.R

+1-1
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@
6262
#' @family Steps for under-sampling
6363
#'
6464
#' @export
65-
#' @examples
65+
#' @examplesIf rlang::is_installed("modeldata")
6666
#' library(recipes)
6767
#' library(modeldata)
6868
#' data(hpc_data)

R/rose.R

+1-1
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@
7575
#' @family Steps for over-sampling
7676
#'
7777
#' @export
78-
#' @examples
78+
#' @examplesIf rlang::is_installed("modeldata")
7979
#' library(recipes)
8080
#' library(modeldata)
8181
#' data(hpc_data)

R/smote.R

+1-1
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@
6666
#' @family Steps for over-sampling
6767
#'
6868
#' @export
69-
#' @examples
69+
#' @examplesIf rlang::is_installed("modeldata")
7070
#' library(recipes)
7171
#' library(modeldata)
7272
#' data(hpc_data)

R/smotenc.R

+1-1
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@
6868
#' @family Steps for over-sampling
6969
#'
7070
#' @export
71-
#' @examples
71+
#' @examplesIf rlang::is_installed("modeldata")
7272
#' library(recipes)
7373
#' library(modeldata)
7474
#' data(hpc_data)

R/tomek.R

+1-1
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@
5353
#' @family Steps for under-sampling
5454
#'
5555
#' @export
56-
#' @examples
56+
#' @examplesIf rlang::is_installed("modeldata")
5757
#' library(recipes)
5858
#' library(modeldata)
5959
#' data(hpc_data)

R/upsample.R

+1-1
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@
6565
#' @family Steps for over-sampling
6666
#'
6767
#' @export
68-
#' @examples
68+
#' @examplesIf rlang::is_installed("modeldata")
6969
#' library(recipes)
7070
#' library(modeldata)
7171
#' data(hpc_data)

README.Rmd

+1-1
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ library(recipes)
5151
library(modeldata)
5252
library(themis)
5353
54-
data("credit_data")
54+
data("credit_data", package = "modeldata")
5555
5656
credit_data0 <- credit_data %>%
5757
filter(!is.na(Job))

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ library(recipes)
4949
library(modeldata)
5050
library(themis)
5151

52-
data("credit_data")
52+
data("credit_data", package = "modeldata")
5353

5454
credit_data0 <- credit_data %>%
5555
filter(!is.na(Job))

man/step_adasyn.Rd

+2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/step_bsmote.Rd

+2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/step_downsample.Rd

+2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/step_nearmiss.Rd

+2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/step_rose.Rd

+2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/step_smote.Rd

+2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/step_smotenc.Rd

+2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/step_tomek.Rd

+2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/step_upsample.Rd

+2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tests/testthat/test-S3-methods.R

+9-13
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,12 @@
1-
data(two_class_dat, package = "modeldata")
2-
3-
# ------------------------------------------------------------------------------
4-
5-
r1 <- recipe(Class ~ ., data = two_class_dat)
6-
r2 <- r1 %>% step_adasyn(Class)
7-
r3 <- r1 %>% step_bsmote(Class)
8-
r4 <- r1 %>% step_downsample(Class)
9-
r5 <- r1 %>% step_nearmiss(Class)
10-
r6 <- r1 %>% step_rose(Class)
11-
r7 <- r1 %>% step_smote(Class)
12-
r8 <- r1 %>% step_tomek(Class)
13-
r9 <- r1 %>% step_upsample(Class)
1+
r1 <- recipe(class ~ ., data = circle_example)
2+
r2 <- r1 %>% step_adasyn(class)
3+
r3 <- r1 %>% step_bsmote(class)
4+
r4 <- r1 %>% step_downsample(class)
5+
r5 <- r1 %>% step_nearmiss(class)
6+
r6 <- r1 %>% step_rose(class)
7+
r7 <- r1 %>% step_smote(class)
8+
r8 <- r1 %>% step_tomek(class)
9+
r9 <- r1 %>% step_upsample(class)
1410

1511
# ------------------------------------------------------------------------------
1612

tests/testthat/test-adasyn.R

+12-9
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,7 @@
1-
library(testthat)
2-
library(recipes)
3-
library(dplyr)
4-
library(modeldata)
5-
61
test_that("errors if there isn't enough data", {
7-
data("credit_data")
2+
skip_if_not_installed("modeldata")
3+
4+
data("credit_data", package = "modeldata")
85
credit_data0 <- credit_data
96

107
credit_data0$Status <- as.character(credit_data0$Status)
@@ -63,7 +60,9 @@ test_that("errors if character are present", {
6360
})
6461

6562
test_that("NA in response", {
66-
data(credit_data)
63+
skip_if_not_installed("modeldata")
64+
65+
data("credit_data", package = "modeldata")
6766

6867
expect_snapshot(error = TRUE,
6968
recipe(Job ~ Age, data = credit_data) %>%
@@ -128,7 +127,9 @@ test_that("ratio value works when oversampling", {
128127
})
129128

130129
test_that("allows multi-class", {
131-
data("credit_data")
130+
skip_if_not_installed("modeldata")
131+
132+
data("credit_data", package = "modeldata")
132133
expect_no_error(
133134
recipe(Home ~ Age + Income + Assets, data = credit_data) %>%
134135
step_impute_mean(Income, Assets) %>%
@@ -137,7 +138,9 @@ test_that("allows multi-class", {
137138
})
138139

139140
test_that("majority classes are ignored if there is more than 1", {
140-
data("penguins")
141+
skip_if_not_installed("modeldata")
142+
143+
data("penguins", package = "modeldata")
141144
rec1_p2 <- recipe(species ~ bill_length_mm + bill_depth_mm,
142145
data = penguins[-(1:28), ]
143146
) %>%

0 commit comments

Comments
 (0)