Re: [R] a problem with is.na

2011-01-26 Thread Martyn Byng
helps Martyn -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of René Holst Sent: 26 January 2011 11:05 To: r-help@r-project.org Subject: [R] a problem with is.na Hello, I have observed the following odd behavior of "is.na( )" a

Re: [R] a problem with is.na

2011-01-26 Thread Henrique Dallazuanna
There isn't combination of c(1, 1), so is NA: tapply(y, list(X1, X2), sum) On Wed, Jan 26, 2011 at 9:04 AM, René Holst wrote: > Hello, > > I have observed the following odd behavior of "is.na( )" and hope someone > can give me an explanation > Example: > X1=rep(1:2,5)[-1] > X2=rep(1:5,rep(2,5))

[R] a problem with is.na

2011-01-26 Thread René Holst
Hello, I have observed the following odd behavior of "is.na( )" and hope someone can give me an explanation Example: X1=rep(1:2,5)[-1] X2=rep(1:5,rep(2,5))[-1] y= runif(9) y[3]=NA xtabs(y~x1+x2) Now xtabs(is.na(y)~x1+x2) says that cell 2,2 is NA x2 x1 1 2 1 0 0 2 0 1 3 0 0 4 0 0 5