Example Dataset:
var1 var2 result
1 4 5
2 NaN 2
3 5 8
NaN 6 6
NaN NaN NaN
I would like to create a new variable by summing var1 & var2, as seen above. However - I don't want to just replace NaN in var2 with 0s.
This question was closed because someone pointed me towards a question that would fill var2 with zeros. I need the sum to work if either are NaN, and if var1 & var2 are both NaN, I need the resulting new variable to by NaN. I feel like this wasn't answered by the question duplicate I was directed to.
Thanks in Advance