I would like to merge 19 columns with different length from different dataframes and compare them. This is an example:
df1:
PA0001
PA0002
PA0003
PA0004
PA0005
df2:
PA0001
PA0003
PA0006
PA0007
df3:
PA0001
PA0007
etc...
And the output is something like that:
PA0001 | PA0001 | PA0001
PA0002 | NA | NA
PA0003 | PA0003 | NA
PA0004 | NA | NA
PA0005 | NA | NA
NA | PA0006 | NA
NA | PA0007 | PA0007
I used compare
or merge
function but I didn't have a good result. I have tried to used the function of this question: Link
But I got this error:
Error in attributes(.Data) <- c(attributes(.Data), attrib) :
'names' attribute [5254] must be the same length as the vector [2]
Here you are and example:
test1 <- data.frame(c("PA0001","PA0002","PA0003","PA0004","PA0005","PA0006"))
test2 <- data.frame(c("PA0001","PA0002","PA0004","PA0005","PA0007"))
test3 <- data.frame(c("PA0001","PA0004","PA0005","PA0007", "PA0008"))
Thank you very much.