[R] Difference between S-Plus & R 1.2.1

Thomas Lumley tlumley at u.washington.edu
Mon Feb 26 17:24:49 CET 2001

On Mon, 26 Feb 2001, Marc Feldesman wrote:

> Sorry for the uninformative subject.
> The following piece of code gives different output in S-Plus (2K & 6) vs R
> 1.2.1 (Win)
> apply(apehum[,6:15], 2, function(x) which(is.na(x)))
> Why does the R output duplicate every entry where NA's are found?

It doesn't.  Try using length() if you don't believe it.  R has *labels*
(from the row names) on the non-empty vectors, S-PLUS apparently does not.

>							 I can
> eliminate this (in R) by changing the statement to:
> apply(apehum[,6:15], 2, function(x) unique(which(is.na(x))))

Yes, unique() strips the names.

> I'm aware of the differences in the argument list for is.na() between
> S-Plus and R, but changing the default arguments doesn't avoid the
> duplicate entries.
> I'm sure there is a simple explanation but it eludes me right now.



Thomas Lumley			Asst. Professor, Biostatistics
tlumley at u.washington.edu	University of Washington, Seattle

r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch

More information about the R-help mailing list