[R] how to abort script with message
Blew, Ted
TBlew at ETS.ORG
Mon May 21 22:52:29 CEST 2007
Henrik,
yes, probably right, since the way i load the script is via the
'File/Open Script' command in the windows R interface. i tried
'File/Source R code...' and that works fine. thanks very much for your
prompt response!
ted.
-----Original Message-----
From: henrik.bengtsson at gmail.com [mailto:henrik.bengtsson at gmail.com] On
Behalf Of Henrik Bengtsson
Sent: Monday, May 21, 2007 4:23 PM
To: Blew, Ted
Cc: r-help at stat.math.ethz.ch
Subject: Re: [R] how to abort script with message
Hi,
I think the behavior that you outline is due to the fact that you
cut'n'paste the script to the R prompt, is that correct? If so, use
source() instead to run your script, then stop() will do what you want.
/Henrik
On 5/21/07, Blew, Ted <TBlew at ets.org> wrote:
> it is desired to abort an R script with a message, returning to the R
> prompt, pending 'if' results, as follows:
> ------------------------
> first part of script
> .
> .
> if (condition) {
> action
> } else
> {
> 'error'
> abort
> }
> .
> .
> remainder of script
> ---------------------------
>
> note: 'stop' aborts the current script expression but keeps running
> the script.[too little]
> 'quit' aborts the r session. [too much] thx, ted
>
>
>
>
> --------------------------------------------------
> This e-mail and any files transmitted with it may contain privileged
or confidential information.
> It is solely for use by the individual for whom it is intended, even
if addressed incorrectly.
> If you received this e-mail in error, please notify the sender; do not
> disclose, copy, distribute, or take any action in reliance on the
> contents of this information; and delete it from your system. Any
other use of this e-mail is prohibited.
>
> Thank you for your compliance.
> --------------------------------------------------
>
> [[alternative HTML version deleted]]
>
> ______________________________________________
> 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
> and provide commented, minimal, self-contained, reproducible code.
>
--------------------------------------------------
This e-mail and any files transmitted with it may contain privileged or confidential information.
It is solely for use by the individual for whom it is intended, even if addressed incorrectly.
If you received this e-mail in error, please notify the sender; do not disclose, copy, distribute,
or take any action in reliance on the contents of this information; and delete it from
your system. Any other use of this e-mail is prohibited.
Thank you for your compliance.
More information about the R-help
mailing list