[R] Keep sourcing when there is an error
sarah.goslee at gmail.com
Tue Dec 13 23:32:08 CET 2011
Would wrapping the problematic part in try() solve your problem?
On Tue, Dec 13, 2011 at 3:24 PM, Ronan Maron <ronanm2 at gmail.com> wrote:
> I want to know if there is any way to avoid source() stopping when there is
> an error.
> Here is the content of my Main.R script:
> source("~/R/source/Constructor1.R") # Object1 should be constructed
> ifelse(exists("Object1"), # It's an S4 object
> print("Object1 exists"), # I can't avoid using 'validity'
> print("Object1 doesn't exist."))
> source("~/R/source/Main.R") is stopped at the first line when the object
> isn't valid, the three other lines aren't sourced.
> Thank you in advance.
More information about the R-help