Balazs Torma wrote:
> Thank you all for your answers!
>
> The problem is that I don't know the length of the list in advance!  
> And hoped for a convinience structure which reallocates once the  
> preallocated list (or matrix) becomes full.
>   
That's not massively hard to do yourself, is it?
As in

if (i > N) {l <- c(l, vector("list",N); N <- N*2}

i.e.
> N<-1; l <- vector("list", N)
> system.time(for(i in (1:1e5)) { if (i > N) {l <- c(l,
vector("list",N)); N <- N*2} ; l[[i]] <- c(i,i+1,i)})
   user  system elapsed
  1.508   0.012   1.520
> l[i+1:N]<-NULL

-- 
   O__  ---- Peter Dalgaard             Ă˜ster Farimagsgade 5, Entr.B
  c/ /'_ --- Dept. of Biostatistics     PO Box 2099, 1014 Cph. K
 (*) \(*) -- University of Copenhagen   Denmark          Ph:  (+45) 35327918
~~~~~~~~~~ - ([EMAIL PROTECTED])                  FAX: (+45) 35327907

______________________________________________
[email protected] 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.

Reply via email to