Search code examples
rpackagecran

How to include dataset in a r-package?


I'm trying include dataset in my r-package. So, I puted the .rda files in the folder /data. In my examples environment I loaded the dataset by the way:

load("~/mypackage/data/database.rda")

But, when I submited for CRAN, their reported the follows error:

Warning in readChar(con, 5L, useBytes = TRUE) : cannot open compressed file '/home/hornik/mypackage/data/database.rda', probable reason 'No such file or directory'


Solution

  • That error appears because your home folder (~/) is not included in the package. Try to use simple:

    data(database)
    

    You can see more details in the documentation.