hi,
just having the idea create a simple
tcl/tk gui-dialog for different data-file formats
i get starting problems and it would be nice
get some tips/tricks from experienced tcl/tk user in R !
tt <- tktoplevel()
label.widget <- tklabel(tt,text="Decision Tree GUI")
button.widget <- tkbutton(tt,text="Select SPSSFile",
command=function() read.spss("C:/Cummulative/data/wekaSpecial.sav",
use.value.label=T,to.data.frame=T))
tkpack(label.widget,button.widget)
tkdestroy(tt))
....how i have to use command=function() that this works like
cat command ( i get no error message but nothing happen),or better
how can i replace it with tkgetOpenFile and do than an assignment
to a read.table,read.delim or read.spss command ?
i experiment with deparse and substitute, but get no success !
really thanks for advance
and regards,Christian
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
<chr.schulz at email.de> writes:> hi, > > just having the idea create a simple > tcl/tk gui-dialog for different data-file formats > i get starting problems and it would be nice > get some tips/tricks from experienced tcl/tk user in R ! > > tt <- tktoplevel() > label.widget <- tklabel(tt,text="Decision Tree GUI") > button.widget <- tkbutton(tt,text="Select SPSSFile", > command=function() read.spss("C:/Cummulative/data/wekaSpecial.sav", > use.value.label=T,to.data.frame=T)) > tkpack(label.widget,button.widget) > tkdestroy(tt)) > > > ....how i have to use command=function() that this works like > cat command ( i get no error message but nothing happen),or better > how can i replace it with tkgetOpenFile and do than an assignment > to a read.table,read.delim or read.spss command ? > > i experiment with deparse and substitute, but get no success !You'll need something a bit more elaborate, and possibly a little more experience with R programming in general. I'd try omething like getfile <- function() { name <- tclvalue(tkgetOpenFile(filetypes "{{C files} {.c}} {{All files} *}")) if (name == "") return; zz <- read.spss(name, use.value.label=T, to.data.frame=T) assign("myData", zz, envir = .GlobalEnv) } button.widget <- tkbutton(tt,text="Select SPSSFile", command=getfile) Obviously, you might want to extend this with a way to specify a different name for the file, error checks, actual analyses, and so forth. -- O__ ---- Peter Dalgaard Blegdamsvej 3 c/ /'_ --- Dept. of Biostatistics 2200 Cph. N (*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918 ~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk) FAX: (+45) 35327907 -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- 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 _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
>Date: Thu, 26 Sep 2002 21:24:43 +0200 >MIME-Version: 1.0 >From: <chr.schulz at email.de> >To: r-help at stat.math.ethz.ch >Subject: [R] tcltk - command=function() >Content-Transfer-Encoding: 7bit > >hi, > >just having the idea create a simple >tcl/tk gui-dialog for different data-file formats >i get starting problems and it would be nice >get some tips/tricks from experienced tcl/tk user in R !Is this what you want? anyName <- NULL getFile <- function(){ anyName <<- tkcmd("tk_getOpenFile") } tt <- tktoplevel() label.widget <- tklabel(tt,text="Decision Tree GUI") button.widget <- tkbutton(tt,text="Select SPSSFile", command = getFile) tkpack(label.widget,button.widget) anyName will get what you selected from the tk_getOpenFile> >tt <- tktoplevel() >label.widget <- tklabel(tt,text="Decision Tree GUI") >button.widget <- tkbutton(tt,text="Select SPSSFile", >command=function() read.spss("C:/Cummulative/data/wekaSpecial.sav", >use.value.label=T,to.data.frame=T)) >tkpack(label.widget,button.widget) >tkdestroy(tt)) > > >....how i have to use command=function() that this works like >cat command ( i get no error message but nothing happen),or better >how can i replace it with tkgetOpenFile and do than an assignment >to a read.table,read.delim or read.spss command ? > >i experiment with deparse and substitute, but get no success ! > >really thanks for advance >and regards,Christian > > > >-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- >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 >_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- 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 _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
peter,
really thanks, that is a big step - especially the tclvalue function
and it works well - now i could extend as you mentioned ;-))
regard,christian
Peter Dalgaard BSA schrieb:
<chr.schulz at email.de> writes:
hi,
just having the idea create a simple
tcl/tk gui-dialog for different data-file formats
i get starting problems and it would be nice
get some tips/tricks from experienced tcl/tk user in R !
tt <- tktoplevel()
label.widget <- tklabel(tt,text="Decision Tree GUI")
button.widget <- tkbutton(tt,text="Select SPSSFile",
command=function() read.spss("C:/Cummulative/data/wekaSpecial.sav",
use.value.label=T,to.data.frame=T))
tkpack(label.widget,button.widget)
tkdestroy(tt))
....how i have to use command=function() that this works like
cat command ( i get no error message but nothing happen),or better
how can i replace it with tkgetOpenFile and do than an assignment
to a read.table,read.delim or read.spss command ?
i experiment with deparse and substitute, but get no success !
You'll need something a bit more elaborate, and possibly a little more
experience with R programming in general. I'd try omething like
getfile <- function() {
name <- tclvalue(tkgetOpenFile(filetypes "{{C files}
{.c}} {{All files} *}"))
if (name == "") return;
zz <- read.spss(name, use.value.label=T, to.data.frame=T)
assign("myData", zz, envir = .GlobalEnv)
}
button.widget <- tkbutton(tt,text="Select SPSSFile",
command=getfile)
Obviously, you might want to extend this with a way to specify a
different name for the file, error checks, actual analyses, and so
forth.
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._