[R] Creating datasets in packages
Hutchinson,David [PYR]
David.Hutchinson at ec.gc.ca
Thu Apr 30 22:55:45 CEST 2009
Yup :( Thanks!
-----Original Message-----
From: csardi.gabor at gmail.com [mailto:csardi.gabor at gmail.com] On Behalf Of Gábor Csárdi
Sent: Thursday, April 30, 2009 1:45 PM
To: Hutchinson,David [PYR]
Cc: Sarah Goslee; r-help at r-project.org
Subject: Re: [R] Creating datasets in packages
On Thu, Apr 30, 2009 at 10:33 PM, Hutchinson,David [PYR] <David.Hutchinson at ec.gc.ca> wrote:
> In developing the package, I have associated datasets (*.rda) stored in the data sub-directory. I built and installed the package successfully.
>
> When I load the BowRiver dataset and USArrests
>
>> data(BowRiver)
>> data(USArrests)
>> ls()
> [1] "data" "USArrests"
>
> Why is mine stored as "data" and not "BowRiver"?
Because you have named it 'data' when you saved it into the .rda file, haven't you?
Gabor
> -----Original Message-----
> From: Sarah Goslee [mailto:sarah.goslee at gmail.com]
> Sent: Thursday, April 30, 2009 1:18 PM
> To: Hutchinson,David [PYR]
> Cc: r-help at r-project.org
> Subject: Re: [R] Creating datasets in packages
>
> The key question:
>>
>> What am I doing wrong?
>
> We don't know what you _did_. How did you save the data?
> Did you follow the directions in the Writing R Extensions manual? Does ls() show the dataset? etc.
>
> You can "access the dataset from data" - do you mean that you can load the data directly from the data directory within your package? How?
>
> Sarah
>
> On Thu, Apr 30, 2009 at 4:03 PM, Hutchinson,David [PYR] <David.Hutchinson at ec.gc.ca> wrote:
>> I am developing an R package which includes datasets. The build and
>> install works correctly. However, when I access the dataset
>> ("BowRiver"), I get:
>>
>>> data(BowRiver)
>>> BowRiver
>> Error: object "BowRiver" not found. However, I can access the dataset
>> from
>>> data
>>
>> Example R datasets (such as USArrests) are loaded and can be accessed
>> by the dataset name:
>>
>>> data(USArrests)
>>> USArrests
>> Murder Assault UrbanPop Rape Alabama 13.2
>> 236 58 21.2 Alaska 10.0 263 48 44.5 Arizona
>> 8.1 294 80 31.0 Arkansas 8.8 190 50 19.5
>> California 9.0 276 91 40.6 ...
>>
>> What am I doing wrong?
>>
>> Thanks in advance,
>> Dave
>>
>>
>
>
> --
> Sarah Goslee
> http://www.functionaldiversity.org
>
> ______________________________________________
> 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.
>
--
Gabor Csardi <Gabor.Csardi at unil.ch> UNIL DGM
More information about the R-help
mailing list