I'd wrap it in try() - the failing function will run, and you can check after the fact whether it failed or not.
Sarah On Wed, Oct 17, 2012 at 3:48 PM, Jonathan Greenberg <j...@illinois.edu> wrote: > The code base is a bit too complicated to paste in here, but the gist of my > question is this: given I have a function > > myfunction <- function(x) > { > # Do something A > # Do something B > # Do something C > } > > Say "#Do something B" returns this error: > Error in cat(list(...), file, sep, fill, labels, append) : > argument 2 (type 'list') cannot be handled by 'cat' > > A standard function would stop here. HOWEVER, I want, in this odd case, to > say "keep going" to my function and have it proceeed to # Do something C. > How do I accomplish this? I thought suppressWarnings() would do it but it > doesn't appear to. > > Assume that debugging "Do something B" is out of the question. Why am I > doing this? Because in my odd case, "Do something B" actually does what I > needed it to, but returned an error that is irrelevant to my special case > (it creates two files, failing on the second of the two files -- but the > first file it creates is what I wanted and there is no current way to > create that single file on its own without a lot of additional coding). > > --j -- Sarah Goslee http://www.functionaldiversity.org ______________________________________________ R-help@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.