You put these in the testthat
folder (inside tests
). There, you include any "external" file that you might use for your tests (or that provides some additional explanation that the user might find informative, such as in a ".txt") file. You also have your .r
testfiles here.
Alternatively (or, in addition): you can also load your file from another location, by including the path to the file (e.g., to your data
folder--use a relative path). However, this can result in a fragile infrastructure, since you might not be able to rely on that external location to be available at all times, in which case testthat
will raise an error when it can not find the file.
An example of linking to a file outside of tests
, see here. Beware when you do this, though.