Dear Dongmei, On 28 February 2015 14:08, Li, Dongmei wrote:
> Hi, > > I have a question on adding data in R package development. This is my > first time to write a R package and I used the Rstudio for it. I save an > example data into .Rda format using the save() function in R and put in > into the data subdirectory in my package. When I used Rstudio to compile > the vignettes file, it works fine with the following R code: > > ovarian_cancer_ex<-load("~/Documents/RBM/data/ovarian_cancer_example.rda") > ovarian_cancer_ex > [1] "ovarian_cancer_methylation" > summary(ovarian_cancer_methylation) > > > The Rstudio also build the source package successfully. However, it gives > me the following error message after I uploaded to the Bioconductor (whey > they are trying to build packages for different systems using the source > package): > Warning in readChar(con, 5L, useBytes = TRUE) : > cannot open compressed file > '/Users/pkgbuild/Documents/RBM/data/ovarian_cancer_example.rda', probable > reason 'No such file or directory' > > Error: processing vignette 'RBM.Rnw' failed with diagnostics: > chunk 7 > Error in readChar(con, 5L, useBytes = TRUE) : cannot open the connection > Execution halted > > > I will really appreciate if anyone could give me a hint for solving this > issue. Thanks so much for all your help! You are right in putting your serialised object in the data subdirectory. Once your package is installed, these objects can be loaded by simply typing data(ovarian_cancer_ex) Note that you will also need to write a man page. The reason you see the error is because the package is not build in its original location, and hence the file can not be found with the hardcoded path. In such situations, when you want to get the path to a file in a package, for example the extdata directory, you would system.file("extdata", package = "Biobase") Hope this helps, Laurent > Best, > Dongmei > > _______________________________________________ > Bioc-devel@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/bioc-devel _______________________________________________ Bioc-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/bioc-devel