[R] Keep sourcing when there is an error

2011-12-13 Thread Ronan Maron
Hello, 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), #

Re: [R] Keep sourcing when there is an error

2011-12-13 Thread Sarah Goslee
Would wrapping the problematic part in try() solve your problem? On Tue, Dec 13, 2011 at 3:24 PM, Ronan Maron rona...@gmail.com wrote: Hello, 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:

Re: [R] Keep sourcing when there is an error

2011-12-13 Thread Bert Gunter
?try or ?tryCatch or ?withCallingHandlers -- Bert On Tue, Dec 13, 2011 at 12:24 PM, Ronan Maron rona...@gmail.com wrote: Hello, 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:

Re: [R] Keep sourcing when there is an error

2011-12-13 Thread Ronan Maron
Okay, try(Object1 - constructorFunction(args)) # in Constructor1.R works fine. Thank you. __ 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

Re: [R] Keep sourcing when there is an error

2011-12-13 Thread R. Michael Weylandt michael.weyla...@gmail.com
Also, you should probably be using if and else here rather than ifelse. Michael On Dec 13, 2011, at 5:43 PM, Ronan Maron rona...@gmail.com wrote: Okay, try(Object1 - constructorFunction(args)) # in Constructor1.R works fine. Thank you. __