Skip to content

Commit 9fd37ca

Browse files
committed
doc: lint a few more examples
1 parent ff95a70 commit 9fd37ca

3 files changed

Lines changed: 40 additions & 40 deletions

File tree

man/step_lag_difference.Rd

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tests/testthat/test-check_enough_train_data.R

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -19,23 +19,23 @@ test_that("check_enough_train_data works on pooled data", {
1919
expect_no_error(
2020
epi_recipe(toy_epi_df) %>%
2121
check_enough_train_data(x, y, n = 2 * n, drop_na = FALSE) %>%
22-
recipes::prep(toy_epi_df) %>%
23-
recipes::bake(new_data = NULL)
22+
prep(toy_epi_df) %>%
23+
bake(new_data = NULL)
2424
)
2525
# Check both column don't have enough data
2626
expect_error(
2727
epi_recipe(toy_epi_df) %>%
2828
check_enough_train_data(x, y, n = 2 * n + 1, drop_na = FALSE) %>%
29-
recipes::prep(toy_epi_df) %>%
30-
recipes::bake(new_data = NULL),
29+
prep(toy_epi_df) %>%
30+
bake(new_data = NULL),
3131
regexp = "The following columns don't have enough data"
3232
)
3333
# Check drop_na works
3434
expect_error(
3535
epi_recipe(toy_epi_df) %>%
3636
check_enough_train_data(x, y, n = 2 * n - 1, drop_na = TRUE) %>%
37-
recipes::prep(toy_epi_df) %>%
38-
recipes::bake(new_data = NULL)
37+
prep(toy_epi_df) %>%
38+
bake(new_data = NULL)
3939
)
4040
})
4141

@@ -44,32 +44,32 @@ test_that("check_enough_train_data works on unpooled data", {
4444
expect_no_error(
4545
epi_recipe(toy_epi_df) %>%
4646
check_enough_train_data(x, y, n = n, epi_keys = "geo_value", drop_na = FALSE) %>%
47-
recipes::prep(toy_epi_df) %>%
48-
recipes::bake(new_data = NULL)
47+
prep(toy_epi_df) %>%
48+
bake(new_data = NULL)
4949
)
5050
# Check one column don't have enough data
5151
expect_error(
5252
epi_recipe(toy_epi_df) %>%
5353
check_enough_train_data(x, y, n = n + 1, epi_keys = "geo_value", drop_na = FALSE) %>%
54-
recipes::prep(toy_epi_df) %>%
55-
recipes::bake(new_data = NULL),
54+
prep(toy_epi_df) %>%
55+
bake(new_data = NULL),
5656
regexp = "The following columns don't have enough data"
5757
)
5858
# Check drop_na works
5959
expect_error(
6060
epi_recipe(toy_epi_df) %>%
6161
check_enough_train_data(x, y, n = 2 * n - 3, epi_keys = "geo_value", drop_na = TRUE) %>%
62-
recipes::prep(toy_epi_df) %>%
63-
recipes::bake(new_data = NULL)
62+
prep(toy_epi_df) %>%
63+
bake(new_data = NULL)
6464
)
6565
})
6666

6767
test_that("check_enough_train_data outputs the correct recipe values", {
6868
expect_no_error(
6969
p <- epi_recipe(toy_epi_df) %>%
7070
check_enough_train_data(x, y, n = 2 * n - 2) %>%
71-
recipes::prep(toy_epi_df) %>%
72-
recipes::bake(new_data = NULL)
71+
prep(toy_epi_df) %>%
72+
bake(new_data = NULL)
7373
)
7474

7575
expect_equal(nrow(p), 2 * n)
@@ -93,15 +93,15 @@ test_that("check_enough_train_data only checks train data", {
9393
expect_no_error(
9494
epi_recipe(toy_epi_df) %>%
9595
check_enough_train_data(x, y, n = n - 2, epi_keys = "geo_value") %>%
96-
recipes::prep(toy_epi_df) %>%
97-
recipes::bake(new_data = toy_test_data)
96+
prep(toy_epi_df) %>%
97+
bake(new_data = toy_test_data)
9898
)
9999
# Same thing, but skip = FALSE
100100
expect_no_error(
101101
epi_recipe(toy_epi_df) %>%
102102
check_enough_train_data(y, n = n - 2, epi_keys = "geo_value", skip = FALSE) %>%
103-
recipes::prep(toy_epi_df) %>%
104-
recipes::bake(new_data = toy_test_data)
103+
prep(toy_epi_df) %>%
104+
bake(new_data = toy_test_data)
105105
)
106106
})
107107

@@ -111,14 +111,14 @@ test_that("check_enough_train_data works with all_predictors() downstream of con
111111
epi_recipe(toy_epi_df) %>%
112112
step_epi_lag(x, lag = c(1, 2)) %>%
113113
check_enough_train_data(all_predictors(), y, n = 2 * n - 6) %>%
114-
recipes::prep(toy_epi_df) %>%
115-
recipes::bake(new_data = NULL)
114+
prep(toy_epi_df) %>%
115+
bake(new_data = NULL)
116116
)
117117
expect_error(
118118
epi_recipe(toy_epi_df) %>%
119119
step_epi_lag(x, lag = c(1, 2)) %>%
120120
check_enough_train_data(all_predictors(), y, n = 2 * n - 5) %>%
121-
recipes::prep(toy_epi_df) %>%
122-
recipes::bake(new_data = NULL)
121+
prep(toy_epi_df) %>%
122+
bake(new_data = NULL)
123123
)
124124
})

tests/testthat/test-step_training_window.R

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ toy_epi_df <- tibble::tibble(
1111
test_that("step_training_window works with default n_recent", {
1212
p <- epi_recipe(y ~ x, data = toy_epi_df) %>%
1313
step_training_window() %>%
14-
recipes::prep(toy_epi_df) %>%
15-
recipes::bake(new_data = NULL)
14+
prep(toy_epi_df) %>%
15+
bake(new_data = NULL)
1616

1717
expect_equal(nrow(p), 100L)
1818
expect_equal(ncol(p), 4L)
@@ -28,8 +28,8 @@ test_that("step_training_window works with default n_recent", {
2828
test_that("step_training_window works with specified n_recent", {
2929
p2 <- epi_recipe(y ~ x, data = toy_epi_df) %>%
3030
step_training_window(n_recent = 5) %>%
31-
recipes::prep(toy_epi_df) %>%
32-
recipes::bake(new_data = NULL)
31+
prep(toy_epi_df) %>%
32+
bake(new_data = NULL)
3333

3434
expect_equal(nrow(p2), 10L)
3535
expect_equal(ncol(p2), 4L)
@@ -48,8 +48,8 @@ test_that("step_training_window does not proceed with specified new_data", {
4848
# testing data.
4949
p3 <- epi_recipe(y ~ x, data = toy_epi_df) %>%
5050
step_training_window(n_recent = 3) %>%
51-
recipes::prep(toy_epi_df) %>%
52-
recipes::bake(new_data = toy_epi_df[1:10, ])
51+
prep(toy_epi_df) %>%
52+
bake(new_data = toy_epi_df[1:10, ])
5353

5454
expect_equal(nrow(p3), 10L)
5555
expect_equal(ncol(p3), 4L)
@@ -78,8 +78,8 @@ test_that("step_training_window works with multiple keys", {
7878

7979
p4 <- epi_recipe(y ~ x, data = toy_epi_df2) %>%
8080
step_training_window(n_recent = 3) %>%
81-
recipes::prep(toy_epi_df2) %>%
82-
recipes::bake(new_data = NULL)
81+
prep(toy_epi_df2) %>%
82+
bake(new_data = NULL)
8383

8484
expect_equal(nrow(p4), 12L)
8585
expect_equal(ncol(p4), 5L)
@@ -112,20 +112,20 @@ test_that("step_training_window and step_naomit interact", {
112112

113113
e1 <- epi_recipe(y ~ x, data = tib) %>%
114114
step_training_window(n_recent = 3) %>%
115-
recipes::prep(tib) %>%
116-
recipes::bake(new_data = NULL)
115+
prep(tib) %>%
116+
bake(new_data = NULL)
117117

118118
e2 <- epi_recipe(y ~ x, data = tib) %>%
119-
recipes::step_naomit() %>%
119+
step_naomit() %>%
120120
step_training_window(n_recent = 3) %>%
121-
recipes::prep(tib) %>%
122-
recipes::bake(new_data = NULL)
121+
prep(tib) %>%
122+
bake(new_data = NULL)
123123

124124
e3 <- epi_recipe(y ~ x, data = tib) %>%
125125
step_training_window(n_recent = 3) %>%
126-
recipes::step_naomit() %>%
127-
recipes::prep(tib) %>%
128-
recipes::bake(new_data = NULL)
126+
step_naomit() %>%
127+
prep(tib) %>%
128+
bake(new_data = NULL)
129129

130130
expect_identical(e1, e2)
131131
expect_identical(e2, e3)

0 commit comments

Comments
 (0)