[R] Managing global/local variables when creating R packages

Bethany Kok bethanyk at email.unc.edu
Fri Aug 3 03:48:40 CEST 2007


I'm working on a package for R to create graphs for modeling 
interactions between latent variables in SEM.  At the moment, I have one 
function which performs the necessary steps to prepare the data for 
graphing, and then separate graphing functions depending on what graph 
type (or types) the user wants.  To get the prepped data from the setup 
function to the graphing functions, I currently put the data into a 
dataframe and declare it as a global variable (<<-).  Is there a way to 
make a data frame or a set of variables available to all the functions 
in a package but NOT to users?  As it is, if users were to use the var 
name of the data frame for something else, the data will be lost and 
they'll have to rerun setup before creating their graphs. 

Thanks,

Bethany

-- 
Bethany Kok
Graduate Student
Department of Psychology, Davie Hall, CB 3270
University of North Carolina at Chapel Hill
Chapel Hill, NC 27599

TEL:  919-667-4752



More information about the R-help mailing list