[R] help with combining data frames

ggrothendieck@yifan.net ggrothendieck at yifan.net
Wed Mar 6 17:05:53 CET 2002


merge(frame1,frame2)

or do a relational database join using one of the SQL
interfaces to R.

On 6 Mar 2002 at 11:53, 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
> _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
> 


-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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