[R] function to create multiple lists

Patrick Connolly p_connolly at slingshot.co.nz
Sat Jan 30 21:00:58 CET 2010


On Fri, 29-Jan-2010 at 03:16PM -0800, Cat Morning wrote:

|> Hi all,

|> I want to write a function to create multiple lists (over 100
|> lists). For example:

Could it be that you want to create multiple vectors?  That's what it
looks like to me.  If your question is clear, the answer probably will
be too.



|> for(i in 1:5)
|> pi = c(1:5)
|> 
|> but when i type:
|> p2 
|> i get the error
|> Error: object 'p2' not found
|> 
|> I want the lists to be numbered in this fashion, because I want to create another function that goes something like:
|> for(i in 1:5)
|> {if(pi[1]*pi[1] = = 2)
|> print(pi)}
|> 
|> any ideas on how to get around this problem would be greatly appreciated.
|> 
|> Thanks,
|> 
|> Cat
|> 
|> 
|>       
|> 	[[alternative HTML version deleted]]
|> 
|> ______________________________________________
|> 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.

-- 
~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.   
   ___    Patrick Connolly   
 {~._.~}                   Great minds discuss ideas    
 _( Y )_  	         Average minds discuss events 
(:_~*~_:)                  Small minds discuss people  
 (_)-(_)  	                      ..... Eleanor Roosevelt
	  
~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.



More information about the R-help mailing list