[R] Defining a "list"

bartjoosen bartjoosen at hotmail.com
Wed Oct 15 16:38:15 CEST 2008


maybe:

result <- list()
for (i in 1:10) result[[i]] <- rnorm(i)

Bart




Megh Dal wrote:
> 
> Can anyone please tell me how to define a "list". Suppose I want to define
> a list object "result" with length n then want to fill each place of
> "result" with different objects. For e.g.
> 
> i=1
> result[1] = rnorm(1)
> 
> i=2
> result[2] = rnorm(2)
> 
> .......................
> 
> i=n
> result[n] = rnorm(n)
> 
> What would be the best way to do that?
> 
> Regards,
> 
> ______________________________________________
> R-help at 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.
> 
> 

-- 
View this message in context: http://www.nabble.com/Defining-a-%22list%22-tp19991526p19994922.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list