[R] conditional loop

PDXRugger J_R_36 at hotmail.com
Wed Oct 1 00:56:55 CEST 2008

I am looking up a number based upon a randomly selected number and then
proceed to the rest of my code if the corresponding value is greater than or
equal to yet another value.  

so if 

Dev_Size = 14

and my randomly selected number is 102

and i am looking up 102 in the following table

100  21
101  4
102  9
103  52
104  29

So i select the the corresponding value of 102, which is 9 and determine if
it is greater than or equal to Dev_Size and if it is i would proceed, if not
i would like my random number generator to select another number until
complies with the requirement.  I have tried below but my while loop doesnt
do what i would like.  I cant seem to find a good resource for my problem,
any help would be much appreciated.  


#Loads TAZ and corresponding vacant acres data

#Test Location Choice Model selected TAZ 

while(TAZDetermine <= Dev_Size){ 

#Randomly generates test TAZ from 100 to 844

#Renames randomly generated TAZ's object
Loc_Mod_TAZ = RndTAZ

#Create test Development 

#Determines vacant acres by TAZ 

#Displays number of vacant acres in Location Choice Model selected TAZ


View this message in context: http://www.nabble.com/conditional--loop-tp19751172p19751172.html
Sent from the R help mailing list archive at Nabble.com.

More information about the R-help mailing list