[R] division giving spurious NA
Christian Hoffmann
c-w.hoffmann at sunrise.ch
Mon Nov 5 10:57:51 CET 2012
Hi,
I stumbled acros the following disturbing computation:
x <- matrix(c(
2.594028,0.8468867,NA,2.244600,1.215535,0.8233032,NA,3.176697,3.425393,2.5345225,NA,3.247219),nrow=3,byrow=TRUE)
x # having NA in column3 only
x[1:2,]/x[3,]
## [,1] [,2] [,3] [,4]
[1,] 0.7572935 NA NA NA
[2,] 0.4795913 0.253541 NA 0.9782823
where do the two Nas in columns 2 and 4 come from?
TIA
Christian
--
Christian W. Hoffmann,
CH - 8915 Hausen am Albis, Switzerland
Rigiblickstrasse 15 b, Tel.+41-44-7640853
c-w.hoffmann at sunrise.ch,
christian at echoffmann.ch,
www.echoffmann.ch
More information about the R-help
mailing list