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

css - SVG using textPath a symbol not rendering in Firefox -

Java 8 + Maven Javadoc plugin: Error fetching URL -

node.js - How to abort query on demand using Neo4j drivers -