[R] Rekeying value denoting NA

SML parallax at lafn.org
Tue Nov 8 04:10:30 CET 2011


I'm trying to rekey values which denote there is no values, i.e.,
'-999' in a dataset which contains both '-999' and NA entries.
When I try the following command I get the following error:

> data.frame[data.frame$MAR <= -99999,"MAR"] <- NA

"missing values are not allowed in subscripted assignments of data
frames"

Example of data:
YEAR       JAN     FEB     MAR     ...     DEC
1931       5       -999    NA              3
1932       2       1       -999            2
.
.
.
2010       -999    NA      2               1


I've tried to replace the NAs with -999 values first to remove the NA
values, but got the same error.

I'm quite new to R, and these little issues seem to be a stumbling
block. Many thanks for any help you might be able to offer.



More information about the R-help mailing list