Greetings,
I have been working on a script that conducts repeated statistics and
plots to my data. In this case it is sub-setting the dataframe by
month.
The intent is to develop a custom analysis and plotting that I can run
on a large number of data sets.
Unfortunately, a small portion of my subsets (~1%) cause an error with
one of the wrapped subroutines that results in the whole routine
aborting. It would be incredibly difficult to find the cause of this
error post-run, and the particular routine does not have a way of
treating the error (it isn't as simple as NA, etc.)
What I am wondering is if there is a corollary to the conditional
is.na() such as is.error()? Or is there a way to get some other output
from an error than an abort?
That I can use to toggle between a process that causes an error and
one that doesn't without aborting the whole shebang.
Any ideas are appreciated.
I apologize that I could not think up an example so I included a
psuedo-code below.
do.something<-function(x){
run other scripts with data, possibly causing an error
}
do.something.else<-function(x){
Something that doesn't cause an error
}
run.prog<-function(x){
if(IS.ERROR(do.something)){do.something.else}else{do.something} #or
flag error
}
run.prog(data)
#runs everything if there is an error it does not abort with error but
rather does something else that doesn't error and continues.
Thank you very much,
Jon
R 2.6.2
MAC OS 10.5
Jon Loehrke
Graduate Research Assistant
Department of Fisheries Oceanography
School for Marine Science and Technology
University of Massachusetts
200 Mill Road, Suite 325
Fairhaven, MA 02719
[EMAIL PROTECTED]
508-758-6393
______________________________________________
[email protected] 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.