create_testfile.Rd
Use a spreadsheet to create files for use with the testthat package.
create_testfile( ss, sheet, manipulator = NULL, filename = NULL, filepath = NULL, overwrite = FALSE )
ss | dribble or filepath. |
---|---|
sheet | character (vector). The names of the sheets to be read. |
manipulator | a function that manipulates the testdata once it has been read from the spreadsheet |
filename | character (vector). The default is testsheet_<sheet>.R. The number of given filenames must match the length of testdata. |
filepath | character. The defallt is the current working directory |
overwrite | boolean. The default is FALSE. |
ss_path <- testsheets_example("excel") drop_param_y <- function(testdata) { testdata <- testdata %>% dplyr::select(-dplyr::starts_with("param_y")) } filename <- "testsheet_sum_x_only.R" create_testfile(ss_path, sheet = "sum", manipulator = drop_param_y, filename=filename)#>