[R] R Packages and Permanent Datasets creation

Gavin Simpson gavin.simpson at ucl.ac.uk
Wed Jul 29 16:32:46 CEST 2009


On Tue, 2009-07-28 at 23:13 -0700, rajclinasia wrote:
> Our Query:
>  
> Actually while opening R console and R commander we see some packages like
> car and datasets. In these packages we have default datasets. 
> For example: "Women" and "Prestige" so on. Now we created a "Sales" dataset
> importing either from excel, xml or text file. Now we are trying to store
> that dataset permanently  in any one of the packages mentioned above (car or
> datasets). I am able to create them temporarily untill that pirticular
> session.
>  
> But once we close the session and try to log into R Console and R Commander.
> We are not able to find the earlier created datasets "Sales" in the packages
> (Car and Datasets). Kindly suggest how to create permanent datasets in
> packages and also suggest how to create our own packages. 
>  
> If possible please send us the code it will be very helpful for us. 

You *can't* do this (well, not easily, without compiling your own
version of R or the car package).

I don't know how the R Commander package works but I'm fairly certain it
isn't restricted to datasets that come in packages.

Lets take RCmdr our of the equation for a moment. You have an object
'Sales' in your R session. To save this as an R object for reuse in
later sessions, just do

save(Sales, file = "my_Sales_obj.rda")

Next session, before you start RCmdr, do

load(file = "my_Sales_obj.rda")

That will make it available for use.

The filenames I use can be whatever you want and should include the full
path to where you want it saving if not in the current working
directory.

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