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))) S-Plus results: > apply(apehum[,6:15], 2, function(x) which(is.na(x))) $latsupri: numeric(0) $medepico: numeric(0) $pdhtcapi: numeric(0) $mlhtcapi: numeric(0) $aphttroc: [1] 151 152 $mlhttroc: numeric(0) $antartbr: numeric(0) $olecrdep: [1] 151 $humlengt: [1] 105 $biepi: numeric(0) R 1.2.1 results: $latsupri numeric(0) $medepico numeric(0) $pdhtcapi numeric(0) $mlhtcapi numeric(0) $aphttroc 151 152 151 152 $mlhttroc numeric(0) $antartbr numeric(0) $olecrdep 151 151 $humlengt 105 105 $biepi numeric(0) Why does the R output duplicate every entry where NA's are found? I can eliminate this (in R) by changing the statement to: apply(apehum[,6:15], 2, function(x) unique(which(is.na(x)))) 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. Thanks. ===================== Dr. Marc R. Feldesman Professor and Chairman Anthropology Department Portland State University 1721 SW Broadway Portland, Oregon 97201 email: feldesmanm at pdx.edu phone: 503-725-3081 fax: 503-725-3905 http://web.pdx.edu/~h1mf PGP Key Available On Request ====================== "Anyway, no drug, not even alcohol, causes the fundamental ills of society. If we're looking for the source of our troubles, we shouldn't test people for drugs, we should test them for stupidity, ignorance, greed and love of power." P.J. O'Rourke Powered by Optiplochoerus and Windows 2000 (scary isn't it?) -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- 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 _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
Difference between S-Plus & R 1.2.1
2 messages · Marc Feldesman, Thomas Lumley
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)))
<snip>
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 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 _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._