[R] rbind(NULL,NULL)
Martin Maechler
maechler at stat.math.ethz.ch
Mon Apr 8 09:35:15 CEST 2002
>>>>> "Roger" == Roger Koenker <roger at ysidro.econ.uiuc.edu> writes:
Roger> In the time honored spirit of wishing to do nothing
Roger> well, could I suggest that the Splus (versions 5 and 6) response to:
>> rbind(NULL,NULL)
Roger> NULL
Roger> is preferable to the R response:
>> rbind(NULL,NULL)
Roger> Error in rbind(NULL, NULL) : attempt to set an
Roger> attribute on NULL
a simpler example is
rbind(NULL)
or cbind(NULL).
However, I don't see why allowing the above should be better than
giving an error. In R, we have made a distinction between
0-length vectors and NULL for quite a while, and AFAIR, S-plus
has done so, too, in other contexts.
Note that rbind(numeric(0)) {as in rbind(x[x!=x])} *does* work
(i.e. give 0 x 0 matrix, not "NULL"!).
<...>
Roger> It is tempting to conclude from this that Splus does
Roger> nothing better than R, but it is always dangerous to
Roger> generalize from one example.
[ big ;-) ]
Note that S-plus has a bug here: It does not work according to
documentation, since its help(cbind) {or (rbind)} says
>> Build Matrix from Columns or Rows
>>
>> DESCRIPTION:
>>
>> Returns a matrix that is pieced together from several vectors and/or
>> matrices. The functions cbind and rbind are generic. In particular,
>> there are cbind and rbind methods for data frames and classes in the
>> Matrix library.
whereas in your example it returns NULL which is not a matrix...
I hope this doesn't sound too nitpicking, but you started to
talk about the nits.. :-)
With high regards,
Martin
Martin Maechler <maechler at stat.math.ethz.ch> http://stat.ethz.ch/~maechler/
Seminar fuer Statistik, ETH-Zentrum LEO C16 Leonhardstr. 27
ETH (Federal Inst. Technology) 8092 Zurich SWITZERLAND
phone: x-41-1-632-3408 fax: ...-1228 <><
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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