Re: [R] Using stop ( ) from a Text Editor

From: jim holtman <jholtman_at_gmail.com>
Date: Mon, 28 Jul 2008 08:22:32 -0400

If you are using Tinn-R, then I am assuming that you are using the 'send selection' which basically minics the keyboard. On the keyboard, after a 'stop' you can type in the next command without any problems. Here is a script I was using with Tinn-R:

x <- 1
stop('error')
cat('continue processing')

If I select it and send it to R, here is what I get:

> x <- 1
> stop('error')

Error: error
> print('continue processing')

[1] "continue processing"
>

It executed the 'print' command. When I send it in as 'source(selection)' the following is the output:

> source(file('clipboard'))

Error in eval.with.vis(expr, envir, enclos) : error
>

Here is did stop the processing of the script. So if you want it to stop, 'source' in the script instead of 'typing' it in.

On Mon, Jul 28, 2008 at 7:34 AM, Paulo Cardoso <pecardoso_at_netcabo.pt> wrote:
> When using stop clause with a condition, its documented that "If a condition
> object is supplied it should be the only argument, and further arguments
> will be ignored, with a warning".
>
> This will not be the case when running codes from Winedit or TINN?

>
> When I do something like:
>
> if(length(content[content%in%folders])!=4) stop("Execution will be
> interrupted")
>
> from TINN while executing an entire code R will continue reading the code
> anyway.

>
> Is there a way to interrupt the code of being read from a text interface?

>
> Paulo
>
> ______________________________________________
> R-help_at_r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

-- 
Jim Holtman
Cincinnati, OH
+1 513 646 9390

What is the problem you are trying to solve?

______________________________________________
R-help_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Received on Mon 28 Jul 2008 - 12:27:15 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Mon 28 Jul 2008 - 13:32:39 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive