[R] Combining data frames

arun smartpink111 at yahoo.com
Thu May 29 13:18:24 CEST 2014


Hi,

You can try ?merge() or ?join() from library(plyr)
merge(tempr, pr, by="date",all=TRUE)

A.K.


Hi, all!
 I have a problem. I have 2 data frame. Each contains column: "date" and one unique column (temperature and pressure correspondingly). But dates are not a same. First one since 1st Jan 2012 to 31 Dec 2012 once per day. And second one since 5th May 2012 to 31 Sept 2012 once per day.
How can I join these frames by "date" column? Of course I need a second frame is kept in exact time place in first frame by date column.

First table:

head(tempr)
  tempr    date
1  2.7  01/01/12
2  2.3  01/02/12
3  1.7  01/03/12
4  0.1  01/04/12
5  0.2  01/05/12
6  9.4  01/06/12


Second table:
head(pr)
    date       pr
1 05/05/12 1088.000
2 05/06/12 1087.000
3 05/07/12 1087.000
4 05/08/12 1086.999
5 05/09/12 1086.000
6 05/10/12 1086.000 




More information about the R-help mailing list