Hiroyuki Kawakatsu wrote:
Hi,
I get (using r50188)
nrow(NULL)
NULL
NROW(NULL)
[1] 0
ncol(NULL)
NULL
NCOL(NULL)
[1] 1
The last seems 'wrong' to me, though matrix(NA, 0, 1) appears to be
well defined.
Seems consistent with the documentation, which says:
Description
|nrow| and |ncol| return the number of rows or columns present in |x|.
|NCOL| and |NROW| do the same treating a vector as 1-column matrix.
Based on ?NCOL alone, I guess one might be able to quibble about how
NULL should be treated, as the docs do describe the argument as "x a
vector, array or data frame." However, it's pretty common for functions
that work with vectors and arrays to treat NULL the same as numeric(0).
-- Tony Plate
blackhole = matrix(NA, 0, 1)
blackhole[,1] = 5
blackhole
[,1]
h.
______________________________________________
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel