merge - Merging two columns into one in R -


i have following data frame, , trying merge 2 columns one, while replacing na's numeric values.

id        b 1     3     na 2     na    2 3     na    4 4     1     na 

the result want is:

id    new 1     3 2     2 3     4 4     1 

thanks in advance!

you can do: with(d,ifelse(is.na(a),b,a))

where d data frame.


Comments

Popular posts from this blog

Java 8 + Maven Javadoc plugin: Error fetching URL -

android - How to delete or change the searchview icon inside the SearchView actionBar? -

c++ - Msgpack packing bools bug -