The "bug" is that it doesn't print anything; one might argue that this is not a bug, since such an array *is* empty, but I don't buy that argument. It *does* print if #{columns} (= last dimension) > 0 : > array(NA,dim=c(2,0)) > array(NA,dim=c(2,1,0)) > array(NA,dim=c(0,2)) [,1] [,2] > array(NA,dim=c(0,2,1)) , , 1 [,1] [,2] > array(NA,dim=c(0,0,1)) , , 1 S-plus 5.1 does better for matrices but worse (at least in some cases) for higher-rank arrays : > array(NA,dim=c(0,2)) logical matrix: 0 rows, 2 columns. > array(NA,dim=c(0,0,1)) Problem in 1:(length(x)/nm): Missing value where number needed Use traceback() to see the call stack > array(NA,dim=c(0,1,0)) Problem in 1:(length(x)/nm): Missing value where number needed Use traceback() to see the call stack > array(NA,dim=c(1,0,0)) Problem in 1:(length(x)/nm): Missing value where number needed Use traceback() to see the call stack > array(NA,dim=c(1,2,0)) , , [,1] [,2] [1,] NA NA , , [,1] [,2] [1,] NA NA > --------- What should we be doing instead of the current behavior? Typing a "sentence" ---as S+5 does for matrices--- seems quite reasonable; I would want to do this in *all* cases where one of the dimensions is 0. Other suggestions? Martin Maechler <maechler@stat.math.ethz.ch> http://stat.ethz.ch/~maechler/ Seminar fuer Statistik, ETH-Zentrum LEO D10 Leonhardstr. 27 ETH (Federal Inst. Technology) 8092 Zurich SWITZERLAND phone: x-41-1-632-3408 fax: ...-1228 <>< -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- 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 _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
On Wed, 3 May 2000, Martin Maechler wrote:> What should we be doing instead of the current behavior? > Typing a "sentence" ---as S+5 does for matrices--- seems quite reasonable; > I would want to do this in *all* cases where one of the dimensions is 0.I think this would be a good idea: I feel the current behaviour is inconsistent. Trying to standardise to anything else is likely to lead to trouble. In particular, attempting to duplicate the current behaviour for 0 rows in matrices will definitely not scale well to arrays. Jonathan. Jonathan Rougier Science Laboratories Department of Mathematical Sciences South Road University of Durham Durham DH1 3LE http://www.maths.dur.ac.uk/stats/people/jcr/jcr.html -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- 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 _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
On Wed, 3 May 2000, Martin Maechler wrote:> The "bug" is that it doesn't print anything; > one might argue that this is not a bug, since such an array *is* empty, > but I don't buy that argument. >I think printing a message makes sense. The current behaviour of zero-extent arrays and matrices is based on making the fewest possible changes rather than on any particular user-level optimality criterion. -thomas Thomas Lumley Assistant Professor, Biostatistics University of Washington, Seattle -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- 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 _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._