[R] Calling object outside function

PDXRugger J_R_36 at hotmail.com
Wed Sep 24 19:16:57 CEST 2008


What i thought was a simple process isnt working for me.  After i create an
multiple objects in a function (see below), how to i use those objects later
in the program.  I tried calling the function again and then the object i
wanted and it worked the first time but now it doesnt( i think i defined the
object outside the function accidently so then it worked but when run
properly it doesnt).  I did this using 
Testdata(TAZDetermine) to first recall the function then the object i wanted
to use.  This deosnt work and it errors that the object cannot be found.  Do
i use attach?  this didnt seem to work either.  I just want to call an
object defined in a function outside of the function.  Hope you can help

Cheers,
JR


#Function to create hypothetical numbers for process testing 
Testdata=function(TAZ_VAC_ACRES,Loc_Mod_TAZ,Dev_Size,TAZDetermine,Dev_Size){

#Loads TAZ and corresponding vacant acres data
TAZ_VAC_ACRES=
read.csv(file="I:/Research/Samba/urb_transport_modeling/LUSDR/Workspace/BizLandPrice/data/TAZ_VAC_ACRES.csv",header=TRUE);


#Test Location Choice Model selected TAZ 
Loc_Mod_TAZ = 120
#Create test Development 
Dev_Size=58

#Determines vacant acres by TAZ 
TAZDetermine=TAZ_VAC_ACRES[TAZ_VAC_ACRES$TAZ==Loc_Mod_TAZ,2]

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

}

Testdata(TAZDetermine)

error indicating the that function cannot be found even thoug its part of
the argument list in the main function.  

-- 
View this message in context: http://www.nabble.com/Calling-object-outside-function-tp19653634p19653634.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list