Save R objects to separate files tests/testthat/testdata in the
.rds format.
use_testdata( ..., subdir = NULL, overwrite = FALSE, ignore = FALSE, compress = TRUE, refhook = NULL, version = NULL ) use_testdata_raw(name = NULL) has_testdata() read_testdata(infile, subdir = NULL) find_testdata(..., path = ".", must_exist = FALSE)
| ... | R objects to save to the |
|---|---|
| subdir |
|
| overwrite | Logical scalar. Should existing files be overwritten? |
| ignore | Should the newly created file be added to |
| compress | a logical specifying whether saving to a named file is
to use |
| refhook | a hook function for handling reference objects. |
| version | the workspace format version to use. |
| name | a |
| infile | rds file to read (must end in .rds, otherwise .rds ending is automatically added) |
| path | Path of the directory to create, relative to the project. |
| must_exist |
|
use_testdata() returns TRUE if object was successfully saved.
has_testdata() returns TRUE if package has a
tests/testthat/testdata folder.
read_testdata() returns a single R object
find_testdata() returns the normalized path to a file in a
in the testdata directory
use_testdata() saves an R object to a testdata dir in the current package.
Other infrastructure:
use_test_subdir(),
use_tester()
if (FALSE) { use_testdata(letters, LETTERS) }