create_testfile: Use a spreadsheet to create files for use with the testthat...

Description Usage Arguments Examples

View source: R/create_testfile.R

Description

Use a spreadsheet to create files for use with the testthat package.

Usage

1
2
3
4
5
6
7
8
create_testfile(
  ss,
  sheet,
  manipulator = NULL,
  filename = NULL,
  filepath = NULL,
  overwrite = FALSE
)

Arguments

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.

Examples

1
2
3
4
5
6
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)

nicole-brewer/testsheets documentation built on Sept. 26, 2021, 6:46 a.m.