Skip to content
Prev 10094 / 63421 Next

cbind/rbind inconsistency with NULL parameter (PR#3595)

The R help for cbind/rbind states:
I presume this means the S language as defined in the Blue Book ("The ^New 
S Language", Becker Chambers & Wilks, 1988), though in a brief reading I 
couldn't find any mention of such a constraint in the sections on Matrices 
and on Arrays (pages 126 thru 135 in my copy), or any mention of such 
constraints or behavior in the descriptions of the functions cbind/rbind() 
and matrix().

FWIW, in S-plus 6.1 zero-extent matrices are allowed, and cbind/rbind do 
not seem to behave in this way (under Windows at least).

E.g.:
S6.1> matrix(nrow=0,ncol=0)
logical matrix: 0 rows, 0 columns.
S6.1> cbind(NULL, matrix(nrow=0,ncol=0))
NULL
S6.1> cbind(numeric(0), matrix(1, nrow=0,ncol=1))
NULL
S6.1>

Also, FWIW, I have argued to Insightful that cbind/rbind returning NULL 
here is a undesirable (along with other examples of inconsistent behavior 
with zero-extent matrices), and they have replied that they have logged 
these as bugs to be fixed in a future release.

-- Tony Plate
At Tuesday 04:31 PM 7/29/2003 +0100, Prof Brian Ripley wrote: