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

From: Paulo Cardoso <pecardoso_at_netcabo.pt>
Date: Mon, 28 Jul 2008 13:36:40 +0100

> I see no condition object in your example

Isn't if(length(content[content%in%folders])!=4) a condition?

> stop() breaks execution of a block of code that source()d -- maybe that is

what you are looking for?

Yes

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

A simple search at Google with the keys 'TINN' or 'Winedit' will provide further information.

Yes. TINN will send the entire lines just like a clipboard paste into R console

Thanks for your comments.

I think that source() is the way as mentioned by Jim Holtman. Please give-me some time to clarify my problem with my concrete example.

Paulo Cardoso

-----Original Message-----
From: Prof Brian Ripley [mailto:ripley_at_stats.ox.ac.uk] Sent: segunda-feira, 28 de Julho de 2008 13:25 To: Paulo Cardoso
Cc: 'r-help'
Subject: Re: [R] Using stop ( ) from a Text Editor

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
No virus found in this incoming message.
Checked by AVG. 

16:18

______________________________________________
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:42:47 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