Re: [R] preallocating matrices and rda read-back objects

2008-04-09 Thread Uwe Ligges
Alexy Khrabrov wrote: > I've read in Phil Spector's new book that it's a good idea to > preallocate a big matrix, like > > u <- matrix(0,nrow,ncol) # (1) > > Now, I read contents of a huge matrix from a Fortran binary dump. > > u <- readBin(con,what="double",n=nrow*ncol) # (2) > > If I do (

[R] preallocating matrices and rda read-back objects

2008-04-08 Thread Alexy Khrabrov
I've read in Phil Spector's new book that it's a good idea to preallocate a big matrix, like u <- matrix(0,nrow,ncol) # (1) Now, I read contents of a huge matrix from a Fortran binary dump. u <- readBin(con,what="double",n=nrow*ncol) # (2) If I do (1) and then (2), u is a vector, obviously it