Re: [R] load only one object from a .RData file

2012-04-24 Thread Shi, Tao
Thank you, Michael and Henrik.  I'll try what you suggested. > > From: Henrik Bengtsson >To: "Shi, Tao" >Cc: "r-help@r-project.org" >Sent: Tuesday, April 24, 2012 12:37 PM >Subject: Re: [R] load only one

Re: [R] load only one object from a .RData file

2012-04-24 Thread Henrik Bengtsson
You could do: library("R.utils"); value <- loadToEnv("MyFile.RData")[["nameOfObject"]]; It still load all of the data, but it is not kept; only the object you grab. /Henrik On Tue, Apr 24, 2012 at 11:30 AM, Shi, Tao wrote: > Hi list, > > > Is there a way to load one specific object from a .RDa

Re: [R] load only one object from a .RData file

2012-04-24 Thread R. Michael Weylandt
I don't think so -- you want to use saveRDS and readRDS if you want to do that. However, if you are given someone else's .RData and need to avoid a name collision, this might work. loadOneName <- function(objName, file, envir = parent.frame(), assign.on.exit = TRUE) { tempEnv <- new.env()

[R] load only one object from a .RData file

2012-04-24 Thread Shi, Tao
Hi list, Is there a way to load one specific object from a .RData file which contains multiple data objects?  Thanks, ...Tao __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://ww