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

From: Prof Brian Ripley <ripley_at_stats.ox.ac.uk>
Date: Mon, 28 Jul 2008 13:24:47 +0100 (BST)

On Mon, 28 Jul 2008, Paulo Cardoso 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".

I see no condition object in your example.

> This will not be the case when running codes from Winedit or TINN?

Please give us some evidence. If you run interactively a single statement comtaining stop(), it stops execution of just that statement.

>
> 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.

Just as will pasting multiple lines into an interactive R session -- that is intentional.

I don't know what you mean by 'TINN' and 'Winedit' (what exact program, how are you using them?) but suspect that they are working just like pasting lines into the R session, or R-for-Windows' own pager and script editor.

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

stop() breaks execution of a block of code that source()d -- maybe that is what you are looking for?

-- 
Brian D. Ripley,                  ripley_at_stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595

______________________________________________
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:30:22 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