im trying to use the rbind function exactly like in this post.
i have 3 dataframes with 2 columns (rownames and "source").
Between the first and second dataframes there are 2 rownames duplicated values and between the first and the third dataframes there's one.
a
TMCS09g1008676 fleshy
TMCS09g1008677 fleshy
TMCS09g1008678 fleshy
TMCS09g1008679 fleshy
TMCS09g1008680 fleshy
TMCS09g1008681 fleshy
TMCS09g1008682 fleshy
TMCS09g1008683 fleshy
b
TMCS09g1008684 rotten
TMCS09g1008685 rotten
TMCS09g1008686 rotten
TMCS09g1008682 rotten
TMCS09g1008688 rotten
TMCS09g1008689 rotten
TMCS09g1008690 rotten
TMCS09g1008691 rotten
TMCS09g1008683 rotten
TMCS09g1008693 rotten
c
TMCS09g1008695 good
TMCS09g1008696 good
TMCS09g1008697 good
TMCS09g1008698 good
TMCS09g1008683 good
TMCS09g1008700 good
TMCS09g1008701 good
TMCS09g1008702 good
TMCS09g1008703 good
TMCS09g1008704 good
TMCS09g1008705 good
after applying the fuction suggested in that post:
duprows <- which(!is.na(match(rownames(a),rownames(b))))
rbind(a, b[-duprows,])
i get this:
> rbind(a, b[-duprows,])
source
TMCS09g1008677 fleshy
TMCS09g1008678 fleshy
TMCS09g1008679 fleshy
TMCS09g1008680 fleshy
TMCS09g1008681 fleshy
TMCS09g1008682 fleshy
TMCS09g1008683 fleshy
8 <NA>
Warning message:
In
[<-.factor(
tmp, ri, value = 1L) :
invalid factor level, NA generated
The main thing is that I would like to retain the 2nd column of the dataframe "a" for the duplicated values. How i was clear.
Thanks in advance