Hey R-users, I think I followed the steps but still couldn't figure this out.. I am creating a personal package and I want to include several datasets in the package. I created a subdirectory 'data' in the package, save a dataset 'test.rda' there, built the package, checked it, installed it. Then I loaded the package and tried load(test), data(test), attach(test), none of them gave me the actual data. Another thing, which I am not sure if it is relevant, is that when I was checking the package before installation, I got a warning (not an error) that I have a dataset 'x' without document. I actually don't have any dataset with the name 'x'. Any thoughts? thanks!
include a dataset in my package
3 messages · di jianing, Richard M. Heiberger, Uwe Ligges
An embedded and charset-unspecified text was scrubbed... Name: not available URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20120522/8f6b00ff/attachment.pl>
On 22.05.2012 06:24, Richard M. Heiberger wrote:
you do have a dataset x. it is probably inside the test.rda file. start a fresh R session and library(yourPackage) then ls() data(test)
No, you meant data(x) Note that the name of the filename is still the original mname it had hen creating the rda file, the filename of the rda file is irrelevant (and it may contain more than just one object). Best, Uwe Ligges
ls() ## you will probably have now have x.
Should you need to use load, then use
load("/full/path/to/test.rda") ## in quotes
ls()
The idiom for saving a dataset is
save(mydataset, file="mydataset.rda")
On Mon, May 21, 2012 at 8:45 PM, di jianing<jianingdi at gmail.com> wrote:
Hey R-users, I think I followed the steps but still couldn't figure this out.. I am creating a personal package and I want to include several datasets in the package. I created a subdirectory 'data' in the package, save a dataset 'test.rda' there, built the package, checked it, installed it. Then I loaded the package and tried load(test), data(test), attach(test), none of them gave me the actual data. Another thing, which I am not sure if it is relevant, is that when I was checking the package before installation, I got a warning (not an error) that I have a dataset 'x' without document. I actually don't have any dataset with the name 'x'. Any thoughts? thanks!
______________________________________________ R-help at r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html<http://www.r-project.org/posting-guide.html> and provide commented, minimal, self-contained, reproducible code.
[[alternative HTML version deleted]]
______________________________________________ R-help at r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.