Skip to content
Prev 10087 / 63421 Next

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

Dear Professor Brian Ripley,

please excuse my inability to interpret the help page correctly.

:[help(cbind)]
:     For `cbind' (`rbind'), vectors of zero length are ignored unless
:     the result would have zero rows (columns), for S compatibility.

I guess this implies that NULL is a zero length vector, even though
	> is(NULL, "vector")
	[1] FALSE


:[help(cbind)]
:     (Zero-extent matrices do not occur in S and are not ignored in R.)

So, if neither NULL nor zero-extent matrices are ignored in R, I would
not expect the following results.
	> cbind(NULL,diag(0,0,2))
	     [,1] [,2] [,3]
	> cbind(diag(0,0,0),diag(0,0,2))
	     [,1] [,2]
Apparently, zero-extent matrices are ignored in R, or there is a
difference in the way of (not) ignoring zero-extent matrices and NULLs.
Yes, if you know how to interpret the documentation.

Sincerely
	Johannes Martin
On Tue, 29 Jul 2003, Prof Brian Ripley wrote: