[R] Error in as.environment(pos): using 'as.environment(NULL)' is defunct

Immanuel Seeger jimmy-seeger at web.de
Thu Aug 5 11:55:37 CEST 2010


Hello,
I’m using R 2.11.1 with Tinn-R 1.17.2.4.
I hope the given informations are enough (it’s my first entry here)

The as.environment(pos) error appears in using the following code which
should open a function in an other R-file.
Here some extractions of the code:

....

HZ<-tclVar(seq(length=a,from=1,by=0))        #(a is defined by a
tkentry-element)
VZ<-tclVar(seq(length=a,from=1,by=0))
Aktivität<-tclVar(seq(length=a,from=1,by=0))
VKG<-tclVar(3)
Zugehörigkeit is a matrix.       

#The values can be changed by a tkentry-element.

handler.Berechnung<-function() {
tkconfigure(Ergebnisfenster,
textvariable=tclVar(test2(as.numeric(tclObj(VKG)),as.numeric(tclObj(HZ))
,as.numeric(tclObj(VZ)),as.numeric(tclObj(Aktivität)),as.numeric(tclObj(
tclArray1)))))
}

test2 <- local({source("C:/Berechnung_Funktion.R", local = TRUE)
environment(Berechnung) <- .GlobalEnv
Berechnung })

and:
Button<-tkframe(InputOutputfenster)
tkpack(Button, side='top')
tkpack(tkbutton(Button, text='compute optimal
solution',command=handler.Berechnung))

and the function in the other R-file:
Berechnung<-function(a,b,c,d,e) {
}	

Thanks!



More information about the R-help mailing list