[R] merge

Pete B Peter.Brecknock at bp.com
Mon Apr 19 16:11:15 CEST 2010


Maybe this what you are looking for ....

lines1 <- "CODPROD N1 N3 N4
23 3 55 4
24 5 67 36
25 3 73 24"

df1 <- read.table(textConnection(lines1),header=TRUE)

lines2 <-"CODPROD N1 N2      
30 34 45
45 0 78
65 0 56" 

df2 <- read.table(textConnection(lines2),header=TRUE)

merge(df1, df2, by = intersect(names(df1),names(df2)), all=TRUE) 

HTH

Pete
-- 
View this message in context: http://n4.nabble.com/merge-tp2015796p2015966.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list