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

Immanuel Seeger jimmy-seeger at web.de
Sun Aug 8 10:58:21 CEST 2010


Hello,
unfortunately I haven't gotten an answer up to now. You can see my
question/problem below in the first mail.
Is the given extract too unspecific?

I haven't solved the problem but I think that it's in the
handler.Berechnung function. Maybe I'm using wrong data-types (there are
vectors defined by tclVar and 'Zugehörigkeit' as a matrix defined by
tclArray). I'm new to R with TK and don't know if
tclvar(as.numeric(tclObj(...))) is the right code to set vectors and
matrices as textvariable.(see below in handler.Berechnung) 

Thanks!



-----Ursprüngliche Nachricht-----
Von: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org]
Im Auftrag von Immanuel Seeger
Gesendet: Donnerstag, 5. August 2010 11:56
An: r-help at r-project.org
Betreff: [R] Error in as.environment(pos): using 'as.environment(NULL)'
isdefunct

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!

______________________________________________
R-help at r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide
http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.



More information about the R-help mailing list