[Rd] cbind/rbind inconsistency with NULL parameter (PR#3585)
jmartin2003 at notamusica.com
jmartin2003 at notamusica.com
Tue Jul 29 18:01:46 MEST 2003
R-Version: 1.7.1 (2003-06-16)
OS: Debian/GNU Linux
cbind and rbind handle NULL parameters inconsistently.
Consider:
> cbind()
NULL
> cbind(NULL)
NULL
And:
> cbind(diag(x = 1, 1, 1))
[,1]
[1,] 1
> cbind(NULL, diag(x = 1, 1, 1))
[,1]
[1,] 1
These seem to indicate that NULL parameters will be ignored in any call to
cbind and rbind. However:
> cbind(NULL, diag(x = 1, 0, 1))
[,1] [,2]
I.e. if one dimension of another parameter to cbind/rbind is zero,
cbind/rbind will create a row/column from the NULL parameter.
This inconsistency creates problems in the construction of matrices within
loops and similar constructs.
More information about the R-devel
mailing list