I have two data frames with identical row.names and colnames. However, the entries in each field vary between the two data.frames.
Like the following structure:
df1 = data.frame(SETD2 = c('AMP', NA, ''), PIK3CA = c('', 'AMP', 'AMP'))
row.names(df1) = c('Sample1', 'Sample2', 'Sample3')
df2 = data.frame(SETD2 = c('', 'Nonstop', 'truncating'), PIK3CA = c('nonsense', 'InFrame', ''))
row.names(df2) = c('Sample1', 'Sample2', 'Sample3')
I am simply looking for an easy solution to merge these two data frames into a single one, where the desired output just looks like
df3 = data.frame(SETD2 = c('AMP;', 'NA;NonStop', 'truncating'), PIK3CA = c('nonsense', 'AMP;InFrame', 'AMP;')
As you can see, just that the individual entries gets merged and separated by a
';'
Many many thanks, chris.