Re: [R] Premature termination of script

From: Patrick Burns <pburns_at_pburns.seanet.com>
Date: Sun 31 Jul 2005 - 06:59:39 EST

You can use 'stop' instead of 'cat' -- in which case you don't need the newline at the end of the string.

But I suspect you would be better off writing a function rather than a script. S Poetry is one of many sources on writing functions.

Patrick Burns
patrick@burns-stat.com
+44 (0)20 8525 0696
http://www.burns-stat.com
(home of S Poetry and "A Guide for the Unwilling S User")

Marco Blanchette wrote:

>I am fairly new to R and I am writing a script that would take a file, as an
>input, and generates a bunch of graphs out of it. My first task is to be
>sure that the file is of the right type by looking if there is a valid
>barcode in it as in (the barcode is beetween a double and single
>underscore):
>
>library(tkWidgets)
>
>##############
>#Loading a file
>#testing if valid if not kill the execution
>##############
>data.file <- fileBrowser(textToShow="Select a splice junction array
>extraction file")
>if ( t <- regexpr("__\\d*_",data.file, perl=T) == -1){
> cat ("The selected file does not seem to be of the right type\n")
> #Should be able to exit the script here
>}
>cat("File look good keep going\n")
>
>How do I prevent R from interpreting the rest of the script if the user
>don't input the right file?
>
>
>
>
>Marco Blanchette, Ph.D.
>
>mblanche@uclink.berkeley.edu
>
>Donald C. Rio's lab
>Department of Molecular and Cell Biology
>16 Barker Hall
>University of California
>Berkeley, CA 94720-3204
>
>Tel: (510) 642-1084
>Cell: (510) 847-0996
>Fax: (510) 642-6062
>
>______________________________________________
>R-help@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
>
>
>
>
>



R-help@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 Received on Sun Jul 31 07:04:22 2005

This archive was generated by hypermail 2.1.8 : Sun 23 Oct 2005 - 14:59:54 EST