@@ -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
6767test_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})
0 commit comments