Message-ID: <CACk-te0Sq=VSKn9SMOzT4KPRv5SeCDh7-n2Y=PRSLY-CRu3v5g@mail.gmail.com>
Date: 2011-12-13T22:36:16Z
From: Bert Gunter
Subject: Keep sourcing when there is an error
In-Reply-To: <4EE7B461.4040600@gmail.com>
?try or ?tryCatch or ?withCallingHandlers
-- Bert
On Tue, Dec 13, 2011 at 12:24 PM, Ronan Maron <ronanm2 at 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:
>
> 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.
> --
> Ronan
>
> ______________________________________________
> R-help at 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.
--
Bert Gunter
Genentech Nonclinical Biostatistics
Internal Contact Info:
Phone: 467-7374
Website:
http://pharmadevelopment.roche.com/index/pdb/pdb-functional-groups/pdb-biostatistics/pdb-ncb-home.htm