Again I need your help for a maybe easy question that is not clear for a starter R user.
I need to manipulate a dataframe to substitute NA
values by "realistic" ones to feed another application.
The data frame contains values of -3.0 that was the flag for non valid values in the original data base. What I need is to replace all the -3.0 values by data coming from another data frame, or maybe to interpolate.
The first data frame would be
1.0 2.0 3.0 4.0
2.0 3.0 -3.0 -3.0
1.0 4.0 -3.0 6.0
1.0 5.0 4.0 5.0
the second one would be
1.0 1.0 1.0 1.0
2.0 2.0 9.0 9.0
2.0 2.0 9.0 2.0
1.0 1.0 1.0 1.0
and the expected result
1.0 2.0 3.0 4.0
2.0 3.0 9.0 9.0
1.0 4.0 9.0 6.0
1.0 5.0 4.0 5.0
I suppose this can be done with a for loop but I haven't found the way to do it.
Thanks in advance