Hi,
On R 2.10.1 for Windows, when I do the following to duplicate the
structure of a large numeric matrix called matrix1:
matrix2 <- matrix(0,nrow=nrow(matrix1),ncol=ncol(matrix1))
and then
rownames(matrix2) <- rownames(matrix1)
I get a "cannot allocate vector of size xxMb" error
but if I instead do:
rnames <- list()
rnames <- rownames(matrix1)
matrix2 <- matrix(0,nrow=nrow(matrix1),ncol=ncol(matrix1),dimnames=rnames)
I get no error.
Of course both approaches work in R on Unix without memory limits. But
I'm intrigued about the apaprent difference in memory usage/allocation
for the two above approaches. Is there any explanation for this
difference in behaviour?
thanks
Tony
______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.