[R] Hidden variables
Joel
joda2457 at student.uu.se
Tue Feb 1 15:27:32 CET 2011
Hi Im trying to make a package in R just to learn how it works.
One thing I dont manage to do is to make a hidden environment or variable so
to say.
I want a "hash list" that I create my useing:
TestEnv<-new.env()
assign("Key1","Ans1",envir=TestEnv)
assign("Key2","Ans2",envir=TestEnv)
Then I just have this function to try it:
TestFunc<- function(Key, ...) UseMethod("TestFunc")
TestFunc.default <- function(Key,...){
Ans<-get(Key, envir=TestEnv)
print(Ans)
}
But when I load this package I can access the TestEnv by just typing
TestEnv, but I want this one hidden so that you only can get the "Ans" from
the "Key" via the TestFunc.
Thx for the help
Joel
--
View this message in context: http://r.789695.n4.nabble.com/Hidden-variables-tp3251588p3251588.html
Sent from the R help mailing list archive at Nabble.com.
More information about the R-help
mailing list