[R] Merging RData files

Duncan Murdoch murdoch.duncan at gmail.com
Tue Jan 16 12:06:03 CET 2018


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      0.000 0.000    NaN   NaN
> pc21.inc        0.903 0.103  8.752 0.000 ***
> pc21.incsq      0.000 0.000    NaN   NaN
> pc21.sei10      0.451 0.145  3.122 0.002 ***
> pc21.sblkprot  -4.334 3.387  1.280 0.201
> ...
> 
> Question: How can I combine/consolidate the two .RData files into one?
> Thank you.



Load both of them, produce the object you want to save, and save it. If 
some objects have the same names in both files, do this carefully:  the 
second load will overwrite the first one.  A safe way to do it is 
described here:  https://www.r-bloggers.com/safe-loading-of-rdata-files-2/

Duncan Murdoch



More information about the R-help mailing list