@@ -19,23 +19,23 @@ test_that("check_enough_train_data works on pooled data", {
19
19
expect_no_error(
20
20
epi_recipe(toy_epi_df ) %> %
21
21
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 )
24
24
)
25
25
# Check both column don't have enough data
26
26
expect_error(
27
27
epi_recipe(toy_epi_df ) %> %
28
28
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 ),
31
31
regexp = " The following columns don't have enough data"
32
32
)
33
33
# Check drop_na works
34
34
expect_error(
35
35
epi_recipe(toy_epi_df ) %> %
36
36
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 )
39
39
)
40
40
})
41
41
@@ -44,32 +44,32 @@ test_that("check_enough_train_data works on unpooled data", {
44
44
expect_no_error(
45
45
epi_recipe(toy_epi_df ) %> %
46
46
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 )
49
49
)
50
50
# Check one column don't have enough data
51
51
expect_error(
52
52
epi_recipe(toy_epi_df ) %> %
53
53
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 ),
56
56
regexp = " The following columns don't have enough data"
57
57
)
58
58
# Check drop_na works
59
59
expect_error(
60
60
epi_recipe(toy_epi_df ) %> %
61
61
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 )
64
64
)
65
65
})
66
66
67
67
test_that(" check_enough_train_data outputs the correct recipe values" , {
68
68
expect_no_error(
69
69
p <- epi_recipe(toy_epi_df ) %> %
70
70
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 )
73
73
)
74
74
75
75
expect_equal(nrow(p ), 2 * n )
@@ -93,15 +93,15 @@ test_that("check_enough_train_data only checks train data", {
93
93
expect_no_error(
94
94
epi_recipe(toy_epi_df ) %> %
95
95
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 )
98
98
)
99
99
# Same thing, but skip = FALSE
100
100
expect_no_error(
101
101
epi_recipe(toy_epi_df ) %> %
102
102
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 )
105
105
)
106
106
})
107
107
@@ -111,14 +111,14 @@ test_that("check_enough_train_data works with all_predictors() downstream of con
111
111
epi_recipe(toy_epi_df ) %> %
112
112
step_epi_lag(x , lag = c(1 , 2 )) %> %
113
113
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 )
116
116
)
117
117
expect_error(
118
118
epi_recipe(toy_epi_df ) %> %
119
119
step_epi_lag(x , lag = c(1 , 2 )) %> %
120
120
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 )
123
123
)
124
124
})
0 commit comments