There is a df with two columns as follows:
method | Value |
---|---|
H2O | 10.2 |
NA | 5.4 |
NA | NA |
I want to assign the word "H2O" to the method column instead of NA
if there is a corresponding value (here is 5.4, but any value) in the Value column. So I want the df to look like this:
method | Value |
---|---|
H2O | 10.2 |
H2O | 5.4 |
NA | NA |
I am looking for a piece of code in R to do this for my entire table.