[R] Using stop ( ) from a Text Editor
Prof Brian Ripley
ripley at stats.ox.ac.uk
Mon Jul 28 14:24:47 CEST 2008
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
More information about the R-help
mailing list