I have a data frame c
like this
c
Freq CTM
000110100111 2 NA
110110100111 1 32.58847
111001011000 2 NA
111111111111 1 25.61041
and a data frame nona_c
like this
nona_c
Freq CTM
000110100111 2 37.0642
111001011000 2 37.0642
I want to replace the NAs in the CTM
column of c
with the CTM values of nona_c
. The rownames of nona_c
(the binary strings) will always exist in c
.
The output should be
mergedC
Freq CTM
000110100111 2 37.0642
110110100111 1 32.58847
111001011000 2 37.0642
111111111111 1 25.61041
I've been trying merge
without success here.
mergedC <- merge(x = c, y = nona_c, by = 0, #rownames
all.y = TRUE)