[R] Help on nested FOR loops

From: Philip Twumasi-Ankrah <nana_kwadwo_derkyi_at_yahoo.com>
Date: Mon, 19 May 2008 12:40:21 -0700 (PDT)


I am new to more radical programming in R. I am trying to write a nested 'for' loop to produce output that takes subscripts like:

for i taking values 1,2,3,4,5 and

    j taking values 1,2,3

I want to output for a computation using the combination values of i and j a value x like this;

i j x
1 1 x11
1 2 x12
1 3 x13
2 1 x21
 2 2 x22
 2 3 x23
3 1 x31
 3 2 x32
 3 3 x33
........
.......

Need help urgently.

Thanks.

Philip

A Smile costs Nothing

     But Rewards Everything

Happiness is not perfected until it is shared

                                                              -Jane Porter        


       
	[[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. Received on Mon 19 May 2008 - 19:47:59 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Mon 19 May 2008 - 23:30:38 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive