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$ ls
data DESCRIPTION man NAMESPACE R
l@np350v5c:~/src/yapomif/pkg$ R
> save(Formaldehyde, file = "data/formal.rda")
l@np350v5c:~/src/yapomif/pkg$ ls -l
totale 20
drwxr-xr-x 2 l l 4096 mag 1 01:31 data
-rw-r--r-- 1 l l 349 apr 25 00:35 DESCRIPTION
drwxr-xr-x 2 l l 4096 apr 25 01:10 man
-rw-r--r-- 1 l l 1189 apr 25 00:33 NAMESPACE
drwxr-xr-x 2 l l 4096 apr 25 01:02 R
l@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 .Rbuildignore
l@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 directories
Removed 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 my development dir clean)
l@np350v5c:~/src/yapomif$ mv yapomif_0.8.tar.gz ~
l@np350v5c:~/src/yapomif$ cd
l@np350v5c:~$ tar xvzf yapomif_0.8.tar.gz
l@np350v5c:~$ ls yapomif
DESCRIPTION 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