[R] Tcl/Tk doubt

Bernardo Rangel Tura tura at centroin.com.br
Mon Jul 15 00:43:17 CEST 2002



Good Night R experts

I make a Tcl/Tk script for generate a histogram from normal distribuition.

----------------------------
gnorm<-function(){
        require(tcltk) || stop("tcltk support is absent")
        base <- tktoplevel()
        done <- tclVar(0)
        mu=tclVar(2)
        var=tclVar(2)
        tkwm.title(base,"Gráfico da Normal")
        heading <- tklabel(base, text="Parâmetros")
        l.mu <- tklabel(base, text="Média")
        l.var <- tklabel(base, text="Variância")
        mu.entry <- tkentry(base, textvariable=mu)
        var.entry <- tkentry(base, textvariable=var)    
        tkgrid(heading, columnspan=2)
        tkgrid(l.mu, mu.entry)
        tkgrid(l.var, var.entry)
        mu<-tclvalue(mu.entry)
        but<-tkbutton(base, text="ok",command=function() {
                tclvalue(done)<-1
                })
        tkgrid(but)
        tkwait.variable(done)
        mu<- as.numeric(tclvalue(mu))
        var<- as.numeric(tclvalue(var.entry))
        x<-rnorm(100,mean=mu,sd=sqrt(var))
        hist(x)
        }
gnorm()
----------------------------
When I click button OK show this error mensage:
Error in structure(.External("dotTcl", ..., PACKAGE = "tcltk"), class = "tclObj") : 
        [tcl] can't read "<environment>": no such variable.

Where this my mistake? Which the correct code?

Please Help Me!

Thanks in advance

Bernardo Rangel Tura, MD
National Institute of Cardiology Laranjeiras
Rio de Janeiro Brazil

P.S
platform i386-pc-mingw32
arch     i386           
os       mingw32        
system   i386, mingw32  
status                  
major    1              
minor    5.1            
year     2002           
month    06             
day      17             
language R   


-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list