[R] help with combining data frames

Jan Goebel jgoebel at diw.de
Wed Mar 6 14:19:18 CET 2002


Hello,

you can use merge to merge data frames
by common columns.
See ?merge.

best

jan

On Wed, 06 Mar 2002, Frank Mattes wrote:

> Dear R user,
> 
> I'm relative new and need some help / advise from you. I have 
> organised my data in several frames, mainly because the data came 
> from different sources. One common variable in all data frames is the
> day post transplantation. I would like to combine the data frame to 
> one big data frame which contains all the data, however no duplicate 
> rows should occour (only one row for one day)
> 
> Here an example which illustrates what I would like to do:
> 
> Frame 1
> Day   Hb   wbc
> 1       10    4
> 3       11    7
> 5        9     6
> 
> 
> Frame 2
> 
> Day   ALT
> 1        60
> 2        70
> 4        50
> 5        80
> 
> Combined
> 
> Day   Hb   wbc   ALT
> 1       10      4     60
> 2        NA    NA    70
> 3       11      7     NA
> 4        NA    NA    50
> 5         9       6     80
> 
> Does anyone know if this can be done, or is it better not to combine 
> the frames ?
> 
> I appreciate any thoughts or help
> 
> Frank Mattes
> Department of Virology
> Royal Free and University Medical School
> London
> -- 
> 
> _________________________________________________________
> 
> 
> 
> -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
> r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
> Send "info", "help", or "[un]subscribe"
> (in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
> _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._

-- 
+-----------------------------------
 Jan Goebel 
 j g o e b e l @ d i w . d e

 DIW Berlin 
 Longitudinal Data and Microanalysis
 Königin-Luise-Str. 5
 D-14195 Berlin -- Germany --
 phone: 49 30 89789-377
+-----------------------------------
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list