[R] Creating a vector
PDXRugger
J_R_36 at hotmail.com
Sat Dec 13 00:10:32 CET 2008
Good day all,
I am having seom trouble building a simple vector. Below my sample code
shows what ime trying to do and i have pointed out where the issue is. What
happens not is that a single "TAZDetermine_FEET" is selected by i need
multiple values, as many as there are "cands". I am thinking that this
should occur within the for loop and add a "TAZDetermine_FEET" to a new
vector ("TAZDs") each time the loop goes round but i cant seem to make it
work using what i know. Probably simple so sorry and any help will be much
appreciated, been struggling with this for too long.
Cheers,
JR
#test location model TAZs
TAZS=101:108
#Builds test Vacant TAZ vector
TAZDEVS=c(125481,174581,556789,14755776,9984275,1324587,12457841,4511475)
#Builds dataframe simulating TAZ_VAC_FEET
TAZ_VAC_FEET=data.frame(TAZS,TAZDEVS)
#Candidate TAZs from location shoice model
cands=c(101,102,107,108)
#Create Object of length of cands
candslength=length(cands)
#Test Location Choice Model selected TAZ
for(i in i:candslength){
#Renames randomly generated TAZ's object
Loc_Mod_TAZ=cands[i]
#Create test Development in Sq. Ft.
Dev_Size=500000
#Determines vacant square feet by TAZ
TAZDetermine_FEET=TAZ_VAC_FEET[TAZ_VAC_FEET$TAZS==Loc_Mod_TAZ,2]
#Heres my problem...my attempt below is to build a vector of
length-"candslength" of all of the
#"TAZDetermine_FEET" values that are less than or equal to Dev_size.
#heres what i have tried, doesnt get me what i want though
#is.vector(TAZDs)
#TAZDs=list(TAZDetermine_FEET)
#TAZDs=vector(mode = "logical", length = candslength)
}
--
View this message in context: http://www.nabble.com/Creating-a-vector-tp20985205p20985205.html
Sent from the R help mailing list archive at Nabble.com.
More information about the R-help
mailing list