Dear Dr Morgan,
Can I use your code as function to convert temporal variables to global as:
Dear All,
I am writing a GUIpackage that needs global variables.
I had many warning message when I checked the code as for example:
geteSet: no visible binding for global variable ‘curselectCases’
I would like to write a function that creates a global place for Objects to be loaded as:
Fun <- function(){
Object <- 5
Var2Global <- function(Object){
.myDataEnv <- new.env(parent=emptyenv()) # not exported
isLoaded <- function(Object) {
exists(Object, .myDataEnv)
}
getData <- function(Object) {
if (!isLoaded(Object)) data(Object, envir=.myDataEnv)
.myDataEnv[[Object]]
}
}
}
To avoid the use of: Object <<- 5
but it seems not working yet. Object == 5 is not a global variable after running Fun().
Any Idea?
Thanks
Karim
Use of this site constitutes acceptance of our User Agreement and Privacy Policy.