Exclude data sets from R package build Exclude data sets from R package build r r

Exclude data sets from R package build


If you use .Rbuildignore you should first build then check your package (it's not a check-ignore). Here a few tests in a Debian environment and a random package:

l@np350v5c:~/src/yapomif/pkg$ lsdata  DESCRIPTION  man  NAMESPACE  Rl@np350v5c:~/src/yapomif/pkg$ R> save(Formaldehyde, file = "data/formal.rda")l@np350v5c:~/src/yapomif/pkg$ ls -ltotale 20drwxr-xr-x 2 l l 4096 mag  1 01:31 data-rw-r--r-- 1 l l  349 apr 25 00:35 DESCRIPTIONdrwxr-xr-x 2 l l 4096 apr 25 01:10 man-rw-r--r-- 1 l l 1189 apr 25 00:33 NAMESPACEdrwxr-xr-x 2 l l 4096 apr 25 01:02 Rl@np350v5c:~/src/yapomif/pkg$ ls -l data/totale 4-rw-r--r-- 1 l l 229 mag  1 01:31 formal.rda

Now i create exactly your .Rbuildignore

l@np350v5c:~/src/yapomif/pkg$ em .Rbuildignorel@np350v5c:~/src/yapomif/pkg$ cat .Rbuildignore^data/.+$

Ok let's build

l@np350v5c:~/src/yapomif/pkg$ cd ..l@np350v5c:~/src/yapomif$ R CMD build pkg> tools:::.build_packages()* checking for file ‘pkg/DESCRIPTION’ ... OK* preparing ‘yapomif’:* checking DESCRIPTION meta-information ... OK* checking for LF line-endings in source and make files* checking for empty or unneeded directoriesRemoved empty directory ‘yapomif/data’* building ‘yapomif_0.8.tar.gz’

Fine (you see the message about yapomif/data). Now check the package

l@np350v5c:~/src/yapomif$ R CMD check yapomif_0.8.tar.gz> tools:::.check_packages()* using log directory ‘/home/l/.src/yapomif/yapomif.Rcheck’* using R version 3.1.0 (2014-04-10)* using platform: x86_64-pc-linux-gnu (64-bit)...

... everything as usual

Now let's check the file (moved to home directory to keep mydevelopment dir clean)

l@np350v5c:~/src/yapomif$ mv yapomif_0.8.tar.gz ~l@np350v5c:~/src/yapomif$ cdl@np350v5c:~$ tar xvzf yapomif_0.8.tar.gzl@np350v5c:~$ ls yapomifDESCRIPTION  man  NAMESPACE  R

so there is no data directory

BUT if

l@np350v5c:~/src/yapomif$ R CMD check pkg...Undocumented data sets:  ‘Formaldehyde’

So, as stated, first build, then check.

HTH, Luca