Re: [R] Merging RData files

2018-01-16 Thread Henrik Bengtsson
To expand on what Bert suggests. Use: loadToEnv <- function(file, ..., envir = new.env()) { base::load(file = file, envir = envir, ...) } envA <- loadToEnv("a.RData") envB <- loadToEnv("b.RData") and then access the objects in environments envA and envB using environment access methods, e.g.

Re: [R] Merging RData files

2018-01-16 Thread Bert Gunter
?load Read this carefully. Pay attention to its instructions re: overwriting existing objects. Cheers, Bert Bert Gunter "The trouble with having an open mind is that people keep coming along and sticking things into it." -- Opus (aka Berkeley Breathed in his "Bloom County" comic strip ) On T

Re: [R] Merging RData files

2018-01-16 Thread Duncan Murdoch
On 16/01/2018 7:13 AM, Steven Yen wrote: Understood. In my case, a.RData and b.RData contain identical variables/data, plus simulation outputs from separate runs. The codes deliver what I need. Good to know the three lines work. Thank you. You might also want to investigate saveRDS/readRDS. T

Re: [R] Merging RData files

2018-01-16 Thread Steven Yen
Understood. In my case, a.RData and b.RData contain identical variables/data, plus simulation outputs from separate runs. The codes deliver what I need. Good to know the three lines work. Thank you. On 1/16/2018 8:06 PM, Duncan Murdoch wrote: > On 16/01/2018 6:33 AM, Steven Yen wrote: >> Hi all,

Re: [R] Merging RData files

2018-01-16 Thread Duncan Murdoch
On 16/01/2018 6:33 AM, Steven Yen wrote: Hi all, This is great. Again, here is what I need. I run two separate jobs (a.R and b.R) with results (say regression outputs) going to a.RData and b.RData. I like to put all results in one place (where I can retrieve them in one place, ab.RData). The foll

Re: [R] Merging RData files

2018-01-16 Thread Steven Yen
Hi all, This is great. Again, here is what I need. I run two separate jobs (a.R and b.R) with results (say regression outputs) going to a.RData and b.RData. I like to put all results in one place (where I can retrieve them in one place, ab.RData). The following codes do it (I am not sure if lin

Re: [R] Merging RData files

2018-01-16 Thread PIKAL Petr
Huh. I may by completely wrong but you cannot do such "merging". .RData files are AFAIK places where all objects from given session are stored. However you could load each .RData file and save/export result (one object). BTW, what do you mean exactly by "combine/consolidate"? And finally, post

Re: [R] Merging RData files

2018-01-16 Thread Duncan Murdoch
On 16/01/2018 3:43 AM, Steven Yen wrote: I ran two separate hours-long projects. Results of each were saved to two separate .RData files. Content of each includes, among others, the following:    me    se  t p sig pc21.age    0.640 0.219  2.918 0.004 *** pc21.agesq