I have DF
like:
A B C D | Va
NA 2 NA 3 | x
1 2 3 4 | x
NA 5 5 2 | x
4 3 2 1 | x
It is needed it to be like:
A B C D | Va
1 2 3 4 | x
4 3 2 1 | x
The aim of is to calculate Va
value. I have already calculate it by some rules previously (lets name it Vb
), but it has low quality. Therefore, I need to calculate Va
to get better values, where I can (where there is no NA
in row). Then I need to get V
vector, where Va
calculated for some rows and Vb
everywhere else. Illustration of what I need:
Va Vb -> V
NA 2 -> 2
1 2 -> 1
NA 2 -> 2
1 2 -> 1
So, I have 2 questions:
1) How to rescale my original DF
to some newDF
, where each row has no NAs with respect to original index in DF
?
2) I have tried Va[is.na(Va)] <- Vb
to test NA
replacement with Vb
values (low quality model). It worked even with message about different length/number of replacements. Is it ok to use it to get what I need or maybe there is something better?