[Rd] naiveBayes.plot does not accept ask=FALSE (needed for use with tkrplot)

From: Dominik <dominik.heier_at_uni-bielefeld.de>
Date: Thu 12 Jan 2006 - 10:27:48 GMT


Dear mailing list members,

I am writing a tiny tcltk interface for a few basic classification methods which should also include plotting density curves with naiveBayes.plot() and tkrplot(). I try to replot the curve using the next input variable of the NaiveBayes by clicking a button in the tkrplot window. Well, it kind of works but: Now I want to make R stop asking me to "Hit <Return> to see next plot" The plot function does not accept the parameter "ask=FALSE". Warning: parameter "ask" could not be set in high-level plot() function. If I precede par(ask=FALSE), nothing changes. Well, I am really not shure wether I use "par()" correctly. (please see function plotfun() below) What do I have to do to run R completley in batch-mode?

thank you in advance
any hint would be greatly appreciated

Dominik Heier



#my codelooks like this:
require(tcltk)
require(tkrplot)
require(klaR)

doBayes<-function() {

    ## selected by former widget . For instance:     DATA<-as.data.frame(iris)
    Output_var="Species"
    ##
    AnzahlZeilen<-nrow(DATA)
    form<-as.formula(paste(Output_var,"~."))    

    bays<-NaiveBayes(form,data=DATA,usekernel=TRUE)   

    bbb<-tktoplevel()
    tkwm.title(bbb,"Bayes-Plot")
    inVars<-names(DATA)[names(DATA)!=Output_var]

    varcount<-1

    plotfun<-function() {

        #par(ask=FALSE)
        plot(bays,inVars[varcount],legendplot = TRUE,ask=FALSE)
        ## I tried to set ask=FALSE but got following warning:
        ## parameter "ask" could not be set in high-level plot() function

}

    bplot<-tkrplot(bbb,plotfun)    

    plotNextVariable <- function() {

        if (varcount==length(inVars)) {
            varcount<<-1
        } else {
            varcount<<-(varcount+1)
        }
        tkrreplot(bplot,function() plot(bays,inVars[varcount],legendplot 
= TRUE))
}

    next.but <- tkbutton(bbb,text="Next input variable",command=plotNextVariable)

    tkpack(bplot,next.but)
}
doBayes()



R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel Received on Thu Jan 12 21:42:52 2006

This archive was generated by hypermail 2.1.8 : Thu 12 Jan 2006 - 11:46:42 GMT