[R] Replace <NA> with something else

eric ericstrom at aol.com
Sun Nov 18 23:24:11 CET 2012


I inserted na.strings='' and that seemed to work except for a problem with a
plot statement

plot(x1$NA,type='l',ylab='M kg/ y ',xlab='')

Error: unexpected numeric constant in "plot(x1$NA"

> tail(x1)
           AP   EU   LA    NA total
Jun 2012 2.32 2.26 5.38 13.74 23.70
Jul 2012 2.46 2.21 5.33 12.94 22.94
Aug 2012 2.69 2.24 5.28 13.32 23.54
Sep 2012 2.62 2.28 5.14 12.99 23.06
Oct 2012 2.61 2.27 5.31 12.59 22.80
Nov 2012 2.55 2.18 5.08 12.56 22.39

> str(x1)
‘zoo’ series from Dec 2007 to Nov 2012
  Data: num [1:60, 1:5] 2.02 1.91 1.79 1.66 1.37 1.25 1.32 1.31 1.32 1.31
...
 - attr(*, "dimnames")=List of 2
  ..$ : NULL
  ..$ : chr [1:5] "AP" "EU" "LA" "NA" ...
  Index: Class 'yearmon'  num [1:60] 2008 2008 2008 2008 2008 ...

What's wrong with my plot statement ?



--
View this message in context: http://r.789695.n4.nabble.com/Replace-NA-with-something-else-tp4649974p4649988.html
Sent from the R help mailing list archive at Nabble.com.




More information about the R-help mailing list