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!
Best,
Dongmei
[Bioc-devel] A question on adding data in R package development
3 messages · Li, Dongmei, Laurent Gatto
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 at r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/bioc-devel
Hi Laurent, Thanks so much for all your help! It works now. Have a nice weekend! Best, Dongmei
On 2/28/15, 9:21 AM, "Laurent Gatto" <lg390 at cam.ac.uk> wrote:
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 at r-project.org mailing list https://urldefense.proofpoint.com/v2/url?u=https-3A__stat.ethz.ch_mailman _listinfo_bioc-2Ddevel&d=AwIBAg&c=4sF48jRmVAe_CH-k9mXYXEGfSnM3bY53YSKuLUQ RxhA&r=azjhQW59umxfk67jsIXeg7AS2ugqKLkykGYJFRwaLto&m=b8-cQqHJDCcJQ12ZIGNG lcYeOp1Y_eg7VSHmu-yUcMw&s=3XR8XyloI-O7xfLl86eOwOtj0F5oNaTLvrKsM-GBABE&e=