Tried to write an R ifelse
statement here, but the parenthesis between ifelse
and is.na()
would disappear in the final format. See below:
This is the preview of the code:
And this is the final outcome:
df$H1 <- ifelseis.na(df$H1), df$H2, df$H1)
Any thoughts?
By the way, the Gist solution is attractive when lots of code makes the post exceed the 5k character limit as the Gist content does not count for this.