[R] problem with NA and if
Keld Jørn Simonsen
keld at dkuug.dk
Fri Jul 4 08:29:34 CEST 2008
Hi
I would like to sum a number of time series, some of them having NA's
Standard action is here that if I sum a value with a NA, then the result
is NA. I would like it to just keep the value.
I then try to:
a = NA; if (a == NA) { a = 0}
just to try it out, but it says
Error in if (a == NA) { : missing value where TRUE/FALSE needed
What is wrong, and can I do it smarter? I looked at na.action but I
don't see how it affects addition of vectors, nor time series.
Best regards
keld
More information about the R-help
mailing list