[R] problem with NA and if
Albert Greinoecker
albert.greinoecker at uibk.ac.at
Fri Jul 4 08:58:27 CEST 2008
try
is.na()
regards,
Albert
Am Freitag, den 04.07.2008, 08:29 +0200 schrieb Keld Jørn Simonsen:
> 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
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
More information about the R-help
mailing list