2

I have developed an R package where I need to use a large dataset for testing. However, I don't want to bundle this dataset with the package (as doing so increases the package size from a few hundred KB to a few hundred MB).

One option is to add this file to .Rbuildignore. However, whilst this allows my tests to pass with devtools::test(), they then fail with devtools::check(). Removing this file from .Rbuildignore allows devtools::check() to pass, but increases the package size.

Is there any way to make this file findable by devtools::check() whilst not bundling it with the package?

DyedPurple
  • 56
  • 5
  • 2
    Are you sure you need to do this? Seems to me there are two possible cases here: 1. This is a package for your own personal use, in which case you don't need to pass `devtools::check()`. 2. You intend to share this package, in which case `devtools::check()` is telling you something important, i.e. others cannot run the tests. – SamR Mar 21 '23 at 12:27
  • I intend to release this package. Perhaps this is showing my naivety in terms of R package development (this is my first one), but I was thinking that it was irrelevant whether others could run the tests in an automated way. Does this happen during installation? I had planned to add a link to this large test dataset in the README so that if users wanted to run all tests then then could, but otherwise they would not need to download it. – DyedPurple Mar 21 '23 at 12:34
  • 1
    Tests aren't usually run during install - whether R even installs tests with the package [depends](https://stackoverflow.com/questions/52175265/how-to-run-a-packages-testthat-tests). But if you're publishing source code which includes tests, they should be runnable. Do your tests need that much data - what are you testing? The [test directory](https://github.com/Rdatatable/data.table/tree/master/inst/tests) for `data.table` is 1.29mb, though it contains a lot of compressed data (`.gz`). If you do need the data to be very large, could you generate test data with some code? – SamR Mar 21 '23 at 12:52
  • 1
    Ok, thank you - I will try to slim down some of the test data (or generate it procedurally). I will leave this question open here though since I am still curious about whether my proposal is technically possible. – DyedPurple Mar 21 '23 at 15:39

0 Answers0