[R] How to catch an error using try
jim holtman
jholtman at gmail.com
Mon Aug 3 18:07:43 CEST 2009
gotError <- try(gene.seq <- getSequence
(id=gene.map[,"ensembl_transcript_id"], type="ensembl_transcript_id",
seqType="3utr", mart=hmart))
if (inherits(gotError, 'try-error')){.....error occurred, do recovery........}
On Mon, Aug 3, 2009 at 11:53 AM, <mauede at alice.it> wrote:
> Sometimes the following function call causes a database exception:
>
>> gene.seq <- getSequence (id=gene.map[,"ensembl_transcript_id"], type="ensembl_transcript_id",
> + seqType="3utr", mart=hmart)
>
> I understand the above function must be called by try to capture the eventual error.
> WHat is not clear to me is how to realize that an error has occurred. The on-line documentation
> mentions an invisible object of class "try-error".
> How shall I test whetehr such object has been created or not ?
> I assume it is created whenever an error does occur ....?
>
> Thank you for your help.
> Maura
>
>
> tutti i telefonini TIM!
>
>
> [[alternative HTML version deleted]]
>
> ______________________________________________
> 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.
>
--
Jim Holtman
Cincinnati, OH
+1 513 646 9390
What is the problem that you are trying to solve?
More information about the R-help
mailing list