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. ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.