I have two data. frame (suppose a,b having a size of 3172*1323, 3067*21), I want to merge both of them however, 21 columns are common in both and 3067 rows also common in both. I want to merge both data frame such that the common rows and common cols replaced and the final size will be 3172*1323 only I tried merge ( a,b, by =0) but it's not going to help me to get the data which I am looking for that. Please help me
A = read.table(header=TRUE, stringsAsFactors=FALSE, row.names=1, text='
Row.names P1 P2 P3 P4 P5
R_1 1 2 3 4 5
R_2 6 7 8 9 10
R_3 8 6 4 2 1
R_4 2 4 6 8 10')
B = read.table(header=TRUE, stringsAsFactors=FALSE, row.names=1, text='
Row.names P2 P5
R_2 NA 2
R_4 1 20')
# merge of A and B
C = read.table(header=TRUE, stringsAsFactors=FALSE, row.names=1, text='
Row.names P1 P2 P3 P4 P5
R_1 1 2 3 4 5
R_2 6 NA 8 9 2
R_3 8 6 4 2 1
R_4 2 1 6 8 20')