use_testdata {testthis} | R Documentation |
Create testdata
folder.
Description
Save R objects to separate files ‘tests/testthat/testdata’ in the
.rds
format.
Usage
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)
Arguments
... |
R objects to save to the ‘testdata’ dir. If empty, an empty directory is created. |
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 |
|
Value
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
Side effects
use_testdata()
saves an R object to a ‘testdata’ dir in the current package.
See Also
Other infrastructure:
use_test_subdir()
,
use_tester()
Examples
## Not run:
use_testdata(letters, LETTERS)
## End(Not run)