order(1, na.last=NA) fails (PR#1913)

brahm@alum.mit.edu brahm@alum.mit.edu
Thu, 15 Aug 2002 22:28:01 +0200 (MET DST)


R> order(1, na.last=NA)
Error in apply(sapply(z, is.na), 1, any) : 
	dim(X) must have a positive length

This bug appears unrelated to PR#1906, and so the fix of 8/15 doesn't help.
It comes from the line inside order():

   ok <- !apply(sapply(z, is.na), 1, any)

where z=list(1) in my example.  sapply() returns a single-element vector, not a
matrix, making apply() unhappy.  This might work better:

   nas <- sapply(z, is.na)
   ok <- if (is.matrix(nas)) !apply(nas, 1, any) else !any(nas)

-----------------------------------------------------------------------------

Version:
 platform = sparc-sun-solaris2.6
 arch = sparc
 os = solaris2.6
 system = sparc, solaris2.6
 status = 
 major = 1
 minor = 5.1
 year = 2002
 month = 06
 day = 17
 language = R

Search Path:
 .GlobalEnv, package:misc, package:io, package:arrays, package:ls1, package:g.data, package:db, package:ts, package:ctest, Autoloads, package:base

-- 
                              -- David Brahm (brahm@alum.mit.edu)

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-devel 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-devel-request@stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._