Dear R List, I have created a package (under Windows 2.0.1) with 300+ data sets and <20 or so functions I use in teaching. However, to access the data, one needs to type data(foo) once the package has been installed and loaded. With other packages namely MASS, after the package is installed and loaded with library(MASS), it is possible to refer to a data set say Animals by simply typing Animals at the command prompt. I would like to have similar functionality in my package. Would someone provide some hints as to what I need to do (read about xxx...or provide a line of code) so that the data in the package can be accessed once it is loaded without typing data(foo) all the time. Currently, when I type the name of a function it shows the code for the function. I would like it to also show the data when I type the name of any of the data sets. Thanks for the pointers in advance. Alan- Alan T. Arnholt Associate Professor Dept. of Mathematical Sciences Appalachian State University
Creating packages with windows (accessing data)
3 messages · Brian Ripley, Alan Arnholt
Look at `Writing R Extensions' and the description of the DESCRIPTION file, specifically `LazyData'. That is the manual about packages ....
On Sun, 17 Apr 2005, Alan Arnholt wrote:
I have created a package (under Windows 2.0.1) with 300+ data sets and <20 or so functions I use in teaching. However, to access the data, one needs to type data(foo) once the package has been installed and loaded. With other packages namely MASS, after the package is installed and loaded with library(MASS), it is possible to refer to a data set say Animals by simply typing Animals at the command prompt. I would like to have similar functionality in my package. Would someone provide some hints as to what I need to do (read about xxx...or provide a line of code) so that the data in the package can be accessed once it is loaded without typing data(foo) all the time. Currently, when I type the name of a function it shows the code for the function. I would like it to also show the data when I type the name of any of the data sets. Thanks for the pointers in advance.
Brian D. Ripley, ripley at stats.ox.ac.uk Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UK Fax: +44 1865 272595
1 day later
Thank you, The DESCRIPTION is what I needed...all works as I want now. Alan- Alan T. Arnholt Associate Professor Department of Mathematical Sciences Appalachian State University Boone, NC 28608 (828) 262 2863 www1.appstate.edu/~arnholta -----Original Message----- From: Prof Brian Ripley [mailto:ripley at stats.ox.ac.uk] Sent: Sunday, April 17, 2005 10:24 AM To: Alan Arnholt Cc: r-help at stat.math.ethz.ch; arnholt at math.appstate.edu Subject: Re: [R] Creating packages with windows (accessing data) Look at `Writing R Extensions' and the description of the DESCRIPTION file, specifically `LazyData'. That is the manual about packages ....
On Sun, 17 Apr 2005, Alan Arnholt wrote:
I have created a package (under Windows 2.0.1) with 300+ data sets and <20 or so functions I use in teaching. However, to access the data, one needs to type data(foo) once the package has been installed and loaded. With other packages namely MASS, after the package is installed and loaded with library(MASS), it is possible to refer to a data set say Animals by simply typing Animals at the command prompt. I would like to have similar functionality in my package. Would someone provide some hints as to what I need to do (read about xxx...or provide a line of code) so that the data in the package can be accessed once it is loaded without typing data(foo) all the time. Currently, when I type the name of a function it shows the code for the function. I would like it to also show the data when I type the name of any of the data sets. Thanks for the pointers in advance.
Brian D. Ripley, ripley at stats.ox.ac.uk Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UK Fax: +44 1865 272595