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. -- View this message in context: http://www.nabble.com/R-Packages-and-Permanent-Datasets-creation-tp24713045p24713045.html Sent from the R help mailing list archive at Nabble.com.
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 %~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
On Tue, Jul 28, 2009 at 11:13:11PM -0700, rajclinasia wrote:> 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.A similar question has been asked very recently by someone else - are you guys related in any way? (e.g. takeing the same class or something). Gavin already pointed out that adding to other peoples packages can (should) not be done - at least not cleanly. He has also pointed out save and load so your problem is probably solved. On the other hand, there could be more to your question, so I'd like to ask WHY you would like to add your own dataset to an exisiting package. Are you simply interested in having you data available in the next session or do you have something else in mind (e.g. distributing the data to others). cu Philipp -- Dr. Philipp Pagel Lehrstuhl f?r Genomorientierte Bioinformatik Technische Universit?t M?nchen Wissenschaftszentrum Weihenstephan 85350 Freising, Germany http://webclu.bio.wzw.tum.de/~pagel/