I'm working on a program that loads several large data files.  I'm  
using ddply (plyr is really awesome) but I want to minimize the amount  
of times a large data file is read in.  One solution is to keep track  
of which data file is open with a global variable and then change the  
currently open data file globally as needed.  However, I'm unclear on  
how to alter a global variable from within a function.  For example

m<-3
a<-function(x) m<-4

a(3)

m

shows that m is still 3 at the end of it all.  With the code above,  
how could I modify the function a to actually set m to whatever value  
I wanted globally?

Thanks for any pointers!

-Jarrett




----------------------------------------
Jarrett Byrnes
Postdoctoral Associate, Santa Barbara Coastal LTER
Marine Science Institute
University of California Santa Barbara
Santa Barbara, CA 93106-6150
http://www.lifesci.ucsb.edu/eemb/labs/cardinale/people/byrnes/index.html


        [[alternative HTML version deleted]]

______________________________________________
R-help@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.

Reply via email to