Closed simonpcouch closed 2 years ago
I think that we would probably recommend that the helper file should have different functions for different data sets. So, for example,
make_ad_data <- function() {
data("ad_data")
ad_mod <- ad_data %>% slice(-(1:10)) %>% select(Class, Genotype, p_tau, MMP10)
ad_pred <- ad_data %>% slice( 1:10 ) %>% select( Genotype, p_tau, MMP10)
ad_mod_x <-
model.matrix(Class ~ ., data = ad_mod) %>%
as.data.frame() %>%
select(-1)
ad_pred_x <-
model.matrix( ~ ., data = ad_pred) %>%
as.data.frame() %>%
select(-1)
ad_mod <- as.data.frame(ad_mod)
ad_pred <- as.data.frame(ad_pred)
list(mod_x = ad_mod_x, pred_x = ad_pred_x, mod = ad_mod, pred = ad_pred)
}
Alright, good to go!
This pull request has been automatically locked. If you believe you have found a related problem, please file a new issue (with a reprex: https://reprex.tidyverse.org) and link to this issue.
At the moment, with the main dev branch of the package, I see:
This was due to some environment / scoping issues in
tests/testthat/helpers.R
that I was able to reproduce on cloud and workbench as well. I opted to instead save the data objects to file and load them at the beginning of tests—this seems somewhat 3e acceptable, but I'm not super opinionated about this implementation. :)