[Rd] print() "bug" for arrays with 0 columns
Martin Maechler
Martin Maechler <maechler@stat.math.ethz.ch>
Wed, 3 May 2000 12:24:23 +0200 (CEST)
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
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._