Skip to content
Prev 309870 / 398506 Next

division giving spurious NA

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