Hello,
Sorry, there's a bug in my first reply. Corrected:
fun <- function(x, y){
df3 <- cbind(x, y[setdiff(names(y), names(x))])
df3[order(names(df3))]
}
fun(df1, df2)
Rui Barradas
Em 07-02-2013 19:16, Rui Barradas escreveu:
Hello,
The following function will give what you s
Hello,
The following function will give what you seem to want.
fun <- function(x, y){
df3 <- x
df3 <- cbind(df3, df2[setdiff(names(y), names(x))])
df3[order(names(df3))]
}
fun(df1, df3)
Hope this helps,
Rui Barradas
Em 07-02-2013 18:36, Anika Masters escreveu:
#I
Hi,
You could use ?merge() or ?join() from library(plyr)
merge(df1,df2,all=TRUE)
# col2 col3 col6 col8 col9 col1
#1 2 3 6 NA NA 1
#2 NA NA NA NA NA NA
A.K.
- Original Message -
From: Anika Masters
To: r-help@r-project.org
Cc:
Sent: Thursday, February 7, 2
3 matches
Mail list logo