[R] How could I terminate a script (without leaving R)?
Mario Valle
mvalle at cscs.ch
Thu May 28 14:58:21 CEST 2009
Good morning!
Which is the preferred method to leave a sourced script and returning back to the '>' prompt?
For example I search for certain files to be processed, but nothing should be done if they
are not present. Normally I do in my script:
f<-dir(pattern="qq")
if(length(f) > 0) {
...process file list...
}
# script end
But I don't like those {} encompassing the whole script so I'm searching for something to
put in place of the '???' here:
f<-dir(pattern="qq")
if(length(f) == 0) '???'
...process file list...
# script end
Using stop("No file found", call.=F) works, but the Error message is ugly in this case.
Any suggestion?
Thanks for your help!
mario
--
Ing. Mario Valle
Data Analysis and Visualization Group | http://www.cscs.ch/~mvalle
Swiss National Supercomputing Centre (CSCS) | Tel: +41 (91) 610.82.60
v. Cantonale Galleria 2, 6928 Manno, Switzerland | Fax: +41 (91) 610.82.82
More information about the R-help
mailing list