Thanks for that. It works as expected now. A case of GIGO (garbage in-
garbage out) on my part, with some head-banging. :-)
Regards
Viju Moses
Yihui Xie wrote:
just put na.omit() inside length() if you intend to omit the NA
elements of the vector (otherwise you are trying to omit the NA's of
t
just put na.omit() inside length() if you intend to omit the NA
elements of the vector (otherwise you are trying to omit the NA's of
the returned value of length() which is a scalar 2):
length(na.omit(sno[a==1 & b==0]))
Regards,
Yihui
--
Yihui Xie
Phone: 515-294-6609 Web: http://yihui.name
Depar
This looks buggish to me (though at least non-intuitive), but I am almost
sure there is an explanation for why the b==0 condition includes the NAs.
You find a way to circumvent it in the last two lines of the example below.
a=c(1,1,1,0,0,0)
b=c(1,NA,0,1,NA,0)
sno=rnorm(6)
na.omit(length(sno[a==1
3 matches
Mail list logo