[R] Summary: length() "ain't misbehavin'" after all

David Parkhurst parkhurs at indiana.edu
Sat Mar 15 00:49:04 CET 2003


I asked why length(byyr$cnd95[byyr$cnd95=="tr"]) was counting NA's as well as "tr"s.
Thanks to Brian Ripley, Uwe Ligges, Ott Toomet, Marc Schwartz, and Thomas Lumley for
their help.

Two solutions were to replace my call with

length[byyr$cnd95 %in% "tr"] or with sum(byyr$cnd95 == "tr", na.rm=TRUE)

and there were variations on those themes.

Thanks again.
Dave



More information about the R-help mailing list