I have 2 data frames A and B of dimensions 2 x 5 like this:
A = data.frame(GeneA1=-0.02:1.89, GeneB2=0.25:1.99, GeneB3=0.17:1.87, GeneB4=0.3:1.63, GeneC2=0.29:1.97, row.names=c("sample 1", "sample 2"))
B = data.frame(GeneA1=0.52:-0.04, GeneB1=1.1:0.08, GeneB3=0.72:0.03, GeneB5=0.78:0.06, GeneC2=0.78:0.25, row.names=c("sample 1", "sample 2"))
For both A & B, the rows are samples and the columns are gene type
I want to try and merge A & B using rbind
, adding NA
s where the gene types don't match up. I've heard there's a way to do this, using the setdiff
argument but I don't know how?