On Fri, 21 Sep 2007, Gabor Csardi wrote:
> I don't know a way of loading parts of an .RData file either,
You can't easily do it, as named objects are not stored separately in such
a file (nor in memory in R). See the 'R Internals' manual for a
description of the format. This would be possible
I don't know a way of loading parts of an .RData file either,
but another solution is to use the envir argument of load to
load the data into a new environment:
> x <- 1
> y <- rnorm(3)
> save.image("tmp.RData")
> rm(x)
> rm(y)
> load("tmp.RData", env <- new.env())
> get("x", env)
[1] 1
> get("y",
I don't know a short way, but this worked when I tried it. Maybe there's a clue
in there somewhere?
get1<-function(fname, varname) {
load(fname)
get(varname)
}
x<-1
y<-rnorm(3)
save.image("temp.RData")
rm(x)
rm(y)
get1("temp.Rdata","x")
get1("temp.Rdata","y")
Steve E
>>> "Marco Venanz
Hi,how can I load a dataset from another file R.Data,without importing all the
objects (functions and other datasets) contained in that file?Thanks, Marco
4 matches
Mail list logo