From dominik.heier at uni-bielefeld.de  Thu Jan 12 11:27:48 2006
From: dominik.heier at uni-bielefeld.de (Dominik)
Date: Thu, 12 Jan 2006 11:27:48 +0100
Subject: [Rd] naiveBayes.plot does not accept ask=FALSE (needed for use with
	tkrplot)
Message-ID: <43C62F24.1000105@uni-bielefeld.de>

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()



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