[R] warning messages

Gabor Grothendieck ggrothendieck at gmail.com
Sun Jun 25 17:25:25 CEST 2006


One small improvement, the cat can be eliminated:

f <- function() {
       x <- readline("c to continue, anything else to quit: ")
       if (x != "c") stop("User forced exit")
       # rest of function
}

f()



On 6/25/06, Gabor Grothendieck <ggrothendieck at gmail.com> wrote:
> Try this:
>
> f <- function() {
>        cat("c to continue, anything else to quit: ")
>        x <- readline()
>        if (x != "c") stop("User forced exit")
>        # rest of function
> }
>
> f()
>
> On 6/25/06, Matthew Bridgman <m.bridgman at sbcglobal.net> wrote:
> > I want to put warning messages into some of my functions to remind
> > myself to change the output file names each time I run them. Is there a
> > way to do this that will allow me to respond to the warning message
> > (i.e. "continue function" or "cancel")?
> >
> > Thanks,
> >   Matt
> >
> > ______________________________________________
> > R-help at stat.math.ethz.ch mailing list
> > https://stat.ethz.ch/mailman/listinfo/r-help
> > PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
> >
>



More information about the R-help mailing list