On 20/01/2008 3:21 PM, Dan Kelley wrote: > The technique > d <- get("d", pos=globalenv()) > doesn't work for me. It just says that it cannot get "d", even though I > have a data/d.rda file. > > Do I have to do something special with namespaces, to find it? > > PS. a possibly-related link is as follows. > > http://www.nabble.com/how-to-make-read-only-data-frames--tp14756183p14756183.html
If you put it in data/d.rda, then it doesn't get loaded until you request it via a call to data(). That's why the get() doesn't work. I think you have two choices: In some file in your R directory, create the object d. You might do this by putting the file into inst/something and loading it from there, or you might just include R source that creates it. Alternatively, put it in the special sysdata.rda file in the R directory. See Writing R Extensions "Package Subdirectories" for instructions. You probably want to specify LazyLoad: yes for your package, so that objects don't take up memory until actually referenced. In either of these cases, the object d will be visible to users as soon as your package is loaded. If you don't want that, you should use a namespace for your package. Duncan Murdoch ______________________________________________ R-help@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.