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
ject.org] Im
Auftrag von Viju Moses
Gesendet: Tuesday, October 06, 2009 12:52 AM
An: r-help@r-project.org
Betreff: [R] Problem with na.omit when using length()
I'm seeing what looks to me like odd behaviour when I use na.omit on a
simple "length" function, as follows.
> sno
[
I'm seeing what looks to me like odd behaviour when I use na.omit on a
simple "length" function, as follows.
> sno
[1] 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
23 24 25 26 27 28 29 30 31 32 33 34
> a
[1] 0 1 0 0 1 1 0 0 0 0 0 0 0 0 1 1 0 1 1 0 0 0 0 0 0 0 0 0 0 0 0 1
4 matches
Mail list logo