@@ -18,22 +18,22 @@ test_that("check_enough_data works on pooled data", {
18
18
# Check both columns have enough data
19
19
expect_no_error(
20
20
epi_recipe(toy_epi_df ) %> %
21
- check_enough_data(x , y , min_data_points = 2 * n , drop_na = FALSE ) %> %
21
+ check_enough_data(x , y , min_observations = 2 * n , drop_na = FALSE ) %> %
22
22
prep(toy_epi_df ) %> %
23
23
bake(new_data = NULL )
24
24
)
25
25
# Check both column don't have enough data
26
26
expect_snapshot(
27
27
error = TRUE ,
28
28
epi_recipe(toy_epi_df ) %> %
29
- check_enough_data(x , y , min_data_points = 2 * n + 1 , drop_na = FALSE ) %> %
29
+ check_enough_data(x , y , min_observations = 2 * n + 1 , drop_na = FALSE ) %> %
30
30
prep(toy_epi_df )
31
31
)
32
32
# Check drop_na works
33
33
expect_snapshot(
34
34
error = TRUE ,
35
35
epi_recipe(toy_epi_df ) %> %
36
- check_enough_data(x , y , min_data_points = 2 * n - 1 , drop_na = TRUE ) %> %
36
+ check_enough_data(x , y , min_observations = 2 * n - 1 , drop_na = TRUE ) %> %
37
37
prep(toy_epi_df )
38
38
)
39
39
})
@@ -42,30 +42,30 @@ test_that("check_enough_data works on unpooled data", {
42
42
# Check both columns have enough data
43
43
expect_no_error(
44
44
epi_recipe(toy_epi_df ) %> %
45
- check_enough_data(x , y , min_data_points = n , epi_keys = " geo_value" , drop_na = FALSE ) %> %
45
+ check_enough_data(x , y , min_observations = n , epi_keys = " geo_value" , drop_na = FALSE ) %> %
46
46
prep(toy_epi_df ) %> %
47
47
bake(new_data = NULL )
48
48
)
49
49
# Check one column don't have enough data
50
50
expect_snapshot(
51
51
error = TRUE ,
52
52
epi_recipe(toy_epi_df ) %> %
53
- check_enough_data(x , y , min_data_points = n + 1 , epi_keys = " geo_value" , drop_na = FALSE ) %> %
53
+ check_enough_data(x , y , min_observations = n + 1 , epi_keys = " geo_value" , drop_na = FALSE ) %> %
54
54
prep(toy_epi_df )
55
55
)
56
56
# Check drop_na works
57
57
expect_snapshot(
58
58
error = TRUE ,
59
59
epi_recipe(toy_epi_df ) %> %
60
- check_enough_data(x , y , min_data_points = 2 * n - 3 , epi_keys = " geo_value" , drop_na = TRUE ) %> %
60
+ check_enough_data(x , y , min_observations = 2 * n - 3 , epi_keys = " geo_value" , drop_na = TRUE ) %> %
61
61
prep(toy_epi_df )
62
62
)
63
63
})
64
64
65
65
test_that(" check_enough_data outputs the correct recipe values" , {
66
66
expect_no_error(
67
67
p <- epi_recipe(toy_epi_df ) %> %
68
- check_enough_data(x , y , min_data_points = 2 * n - 2 ) %> %
68
+ check_enough_data(x , y , min_observations = 2 * n - 2 ) %> %
69
69
prep(toy_epi_df ) %> %
70
70
bake(new_data = NULL )
71
71
)
@@ -90,15 +90,15 @@ test_that("check_enough_data only checks train data when skip = FALSE", {
90
90
epiprocess :: as_epi_df()
91
91
expect_no_error(
92
92
epi_recipe(toy_epi_df ) %> %
93
- check_enough_data(x , y , min_data_points = n - 2 , epi_keys = " geo_value" ) %> %
93
+ check_enough_data(x , y , min_observations = n - 2 , epi_keys = " geo_value" ) %> %
94
94
prep(toy_epi_df ) %> %
95
95
bake(new_data = toy_test_data )
96
96
)
97
97
# Making sure `skip = TRUE` is working correctly in `predict`
98
98
expect_no_error(
99
99
epi_recipe(toy_epi_df ) %> %
100
100
add_role(y , new_role = " outcome" ) %> %
101
- check_enough_data(x , min_data_points = n - 2 , epi_keys = " geo_value" ) %> %
101
+ check_enough_data(x , min_observations = n - 2 , epi_keys = " geo_value" ) %> %
102
102
epi_workflow(linear_reg()) %> %
103
103
fit(toy_epi_df ) %> %
104
104
predict(new_data = toy_test_data %> % filter(time_value > " 2020-01-08" ))
@@ -108,7 +108,7 @@ test_that("check_enough_data only checks train data when skip = FALSE", {
108
108
expect_no_error(
109
109
forecaster <- epi_recipe(toy_epi_df ) %> %
110
110
add_role(y , new_role = " outcome" ) %> %
111
- check_enough_data(x , min_data_points = 1 , epi_keys = " geo_value" , skip = FALSE ) %> %
111
+ check_enough_data(x , min_observations = 1 , epi_keys = " geo_value" , skip = FALSE ) %> %
112
112
epi_workflow(linear_reg()) %> %
113
113
fit(toy_epi_df )
114
114
)
@@ -125,15 +125,15 @@ test_that("check_enough_data works with all_predictors() downstream of construct
125
125
expect_no_error(
126
126
epi_recipe(toy_epi_df ) %> %
127
127
step_epi_lag(x , lag = c(1 , 2 )) %> %
128
- check_enough_data(all_predictors(), y , min_data_points = 2 * n - 5 ) %> %
128
+ check_enough_data(all_predictors(), y , min_observations = 2 * n - 5 ) %> %
129
129
prep(toy_epi_df ) %> %
130
130
bake(new_data = NULL )
131
131
)
132
132
expect_snapshot(
133
133
error = TRUE ,
134
134
epi_recipe(toy_epi_df ) %> %
135
135
step_epi_lag(x , lag = c(1 , 2 )) %> %
136
- check_enough_data(all_predictors(), y , min_data_points = 2 * n - 4 ) %> %
136
+ check_enough_data(all_predictors(), y , min_observations = 2 * n - 4 ) %> %
137
137
prep(toy_epi_df )
138
138
)
139
139
})
0 commit comments