I don't understand this behavior.  Why does the every data point get trashed by 
data.matrix when there is one non-numeric element in the array?  Thanks.
 

> temp 

         GDP  CPIYOY 

19540 2098.1 garbage 

19632 2085.4     0.9 

19724 2052.5     0.8 

19814 2042.4     1.1 


> data.matrix(temp) 

      GDP CPIYOY 

19540   4      4 

19632   3      2 

19724   2      1 

19814   1      3 

>  

 

I'd like garbage to become NA but I tried filtering the array to scrub the data 
but it has no effect.  This illustrates it:

> temp[1,2] <- NA

> temp
         GDP CPIYOY
19540 2098.1   <NA>
19632 2085.4    0.9
19724 2052.5    0.8
19814 2042.4    1.1

> data.matrix(temp)
      GDP CPIYOY
19540   4     NA
19632   3      2
19724   2      1
19814   1      3
> 
-- Art Steinmetz






      
____________________________________________________________________________________
Be a better friend, newshound, and

______________________________________________
R-help@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.

Reply via email to