Dear Chris, If I correctly understand what you want to do, the Rcmdr package uses the following functions (slightly modified from original version contributed by Philippe Grosjean) to solve a similar problem:
RcmdrEnv <- function() { pos <- match("RcmdrEnv", search()) if (is.na(pos)) { # Must create it RcmdrEnv <- list() attach(RcmdrEnv, pos = length(search()) - 1) rm(RcmdrEnv) pos <- match("RcmdrEnv", search()) } return(pos.to.env(pos)) } putRcmdr <- function(x, value) assign(x, value, envir = RcmdrEnv()) getRcmdr <- function(x, mode="any") get(x, envir = RcmdrEnv(), mode = mode, inherits = FALSE) I hope this helps, John -------------------------------- John Fox Department of Sociology McMaster University Hamilton, Ontario Canada L8S 4M4 905-525-9140x23604 http://socserv.mcmaster.ca/jfox -------------------------------- > -----Original Message----- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] On Behalf Of Chris Eisley > Sent: Sunday, January 07, 2007 12:29 AM > To: r-devel@r-project.org > Subject: [Rd] Scoping issues > > Hi everyone, > > I'm trying to split up a large R file that implements a > tcl/tk gui into several smaller ones. The problem is that > the main GUI creation function defines many tclVars and > tkframes that need to be accessible to functions that are > currently defined in main function, but which I'd like to > move to different source files. These files make up a > package, so it seems that using source() is a bad idea. I > could try argument passing, but there are a lot of arguments > to pass in some cases. > > The lexical scoping is hurting me here, but I assume there's > a good way to deal with this kind of issue. Any help is > greatly appreciated. > > -Chris > > ______________________________________________ > R-devel@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-devel ______________________________________________ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel