Re: [R] Problem accessing .Rdata objects in a loop

2012-04-18 Thread francy
Thank you both for your answers. Sorry if I haven't explained myself well, Michael, that is what I was looking for. Using get(n) works, thank you. I wish I could have used saveRDS and readRDS, but it was not my saved object… In any case thanks again. 2012/4/17 Michael Weylandt [via R] : > I'm no

Re: [R] Problem accessing .Rdata objects in a loop

2012-04-17 Thread R. Michael Weylandt
I'm not sure that's francy's problem. This seems to work for me: # Some fake data nms <- letters[1:5] lapply(nms, function(x) assign(x, rnorm(10), .GlobalEnv)) # Make some .Rdata files lapply(nms, function(x) save(list =x, file = paste0(x, ".Rdata"))) # Check they are there list.files() # Bring

Re: [R] Problem accessing .Rdata objects in a loop

2012-04-17 Thread Bert Gunter
Try reading ?load again. It takes a single filename only. Also 'n' is a character, not a symbol for a variable. I think you need to do some reading on basic programming. Try An Introduction to R (part of the distro) to get you going. -- Bert On Tue, Apr 17, 2012 at 8:38 AM, francy wrote: > Hi,

[R] Problem accessing .Rdata objects in a loop

2012-04-17 Thread francy
Hi, I am trying to access many .Rdata objects and do some operations with them using a loop. I can load the files but can't access them. The files' names are stored in a character vector called "names". After loading the objects, I can view each one using ls() and see that two objects are present