r - Tcl/Tk Referencing user-selected values in script -
a quick question regarding tcl/tk , r. below have slice of code corresponds tk button executes todo<-function(){...}
.
my presumption both summary.mydata()
, ggplot()
commands execute. said, question whether or not have correctly coded each command reference correct selected variable (the tk widget controlling working fine, not depicted).
namely if arguments each command valid.
summary.mydata<-summaryse(mydata, measurevar=paste(tx.choice1), groupvars=paste(tx.choice2),conf.interval=0.95,na.rm=true,.drop=false)
would read r as
summary.mydata<-summaryse(mydata, measurevar=measure, groupvars=group,conf.interval=0.95,na.rm=true,.drop=false)
and
ggplot(data=summary.mydata,aes(x=paste(tx.choice2),y=paste(tx.choice1)))+ geom_errorbar(aes(ymin=formula(paste(tx.choice1),"-ci"),ymax=formula(paste(tx.choice1),"+ci")), colour="black", width=.5, position=pd)+ geom_point(position=pd, size=3)+ labs(title=paste("interval plot of",tx.choice1,"by",tx.choice2))
will read as
ggplot(data=summary.mydata, aes(x=group, y=measure))+ geom_errorbar(aes(ymin=measure-ci, ymax=measure+ci), colour="black", width=.5, position=pd)+ geom_point(position=pd, size=3)+ labs(title = "new plot title",x="x",y="y")
the slice reference:
todo<-function(){ tx.choice1<<-vars.name.num[as.integer(tkcurselection(tl1))+1] tx.choice2<<-vars.name.fac[as.integer(tkcurselection(tl2))+1] numb.select.num<<-length(tx.choice1) numb.select.fac<<-length(tx.choice2) windows() if (numb.select.num!=0){ if (numb.select.fac==0){ stop(tkmessagebox(message="please select @ least 1 categorical variable!", icon="error")) } else if (numb.select.fac==1) { if(tclvalue(intervalplot_title)=="" & tclvalue(intervalplot_x)=="" & tclvalue(intervalplot_y)==""){ summary.mydata<-summaryse(mydata, measurevar=paste(tx.choice1), groupvars=paste(tx.choice2),conf.interval=0.95,na.rm=true,.drop=false) ggplot(data=summary.mydata,aes(x=paste(tx.choice2),y=paste(tx.choice1)))+ geom_errorbar(aes(ymin=formula(paste(tx.choice1),"-ci"),ymax=formula(paste(tx.choice1),"+ci")), colour="black", width=.5, position=pd)+ geom_point(position=pd, size=3)+ labs(title=paste("interval plot of",tx.choice1,"by",tx.choice2)) } else { summary.mydata<-summaryse(mydata, measurevar=paste(tx.choice1), groupvars=c(paste(tx.choice2)),conf.interval=0.95,na.rm=true,.drop=false) ggplot(data=summary.mydata,aes(x=paste(tx.choice2),y=paste(tx.choice1)))+ geom_errorbar(aes(ymin=paste(tx.choice1)-ci,ymax=paste(tx.choice1)+ci), colour="black", width=.5, position=pd)+ geom_point(position=pd, size=3)+ labs(title=tclvalue(intervalplot_title),x=tclvalue(intervalplot_x),y=tclvalue(intervalplot_y)) } tkinsert(txt,"end",paste("\nintervalplot of", tx.choice1,"by",tx.choice2[1],"\n\n")) } }
figured out, correct usage paste(tx.choice1,"-ci")
. there no need add formula()
condition.
Comments
Post a Comment