[R] how to add a new dataset to default R distributions

Gavin Simpson gavin.simpson at ucl.ac.uk
Tue Jul 28 16:08:34 CEST 2009


On Tue, 2009-07-28 at 04:54 -0700, Albert EINstEIN wrote:
> Hi,
> Thanks for your support. we are not getting any thing from your code. i.e.
> we are unable to creating new package and adding dataset to that new
> package. so can you help me out in other way i.e.
> how to add a new dataset to default R distributions like "cars and
> datasets". these two are default distributions (i.e. packages). so please
> help us in this aspect.
> 
> Thanks in advance. 

Highly likely that that won't happen as you are asking R Core to
maintain your data sets. You should use a package for this - hundreds of
other useRs have done so!

Given that creating your own package is easy once you've read R Exts
manual:

http://cran.r-project.org/doc/manuals/R-exts.html

despite seeming a bit daunting at first if you are new to this kind of
thing. And creating a data set is as easy as getting the data into R and
formatting it as required and then, if the data are in object 'foo'
doing:

save(foo, file = "foo.rda")

Then move the foo.rda file to the data directory in your package
structure (see ?package.skeleton to do even this bit for you). Then
write an Rd help page to describe the data, and that data set is
included.

You can store your data in other formats (csv say) and there you don't
even need to get it into R first, just drop the csv file in the ./data
directory.

Given that you completely fail to provide *any* of the requested
information mentioned in the posting guide, how can we help you? You
don't tell us what didn't work. Given the evidence of this and other
posts, I suspect lack of effort on your part yet you seem to be
requesting more and more help from the rest of us.

Read the posting guide and form an appropriate posting and then maybe
people on the list can sort out what is not working for you.

G

-- 
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
 Dr. Gavin Simpson             [t] +44 (0)20 7679 0522
 ECRC, UCL Geography,          [f] +44 (0)20 7679 0565
 Pearson Building,             [e] gavin.simpsonATNOSPAMucl.ac.uk
 Gower Street, London          [w] http://www.ucl.ac.uk/~ucfagls/
 UK. WC1E 6BT.                 [w] http://www.freshwaters.org.uk
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%




More information about the R-help mailing list