On 5/25/2012 12:48 PM, John Kerpel wrote:
Jim:
That's the ticket! I'm actually using parLapply with a long, ugly function
- so I was loath to post that mess.
Many thanks - you saved my weekend.
In the context of tryCatch in your question
lst <- list(1, 2, -3, 4)
sapply(lst, function(x)
Jim:
That's the ticket! I'm actually using parLapply with a long, ugly function
- so I was loath to post that mess.
Many thanks - you saved my weekend.
On Fri, May 25, 2012 at 2:23 PM, jim holtman wrote:
> Please show us the 'lapply' statement you are using. Here is a simple
> case of catchi
Please show us the 'lapply' statement you are using. Here is a simple
case of catching an error in an lapply and continuing:
> lapply(c(1,2,-3, 4), function(x){
+ a <- try(stopifnot(x > 0)) # force an error
+ if (inherits(a, 'try-error')) return(NULL)
+ x
+ })
Error : x > 0 is not TR
Folks:
I've replaced an outer for-loop with lapply and it works great. But, I
can't seem to do the following type of exception handling:
tryCatch(dlmMLE(x)$value==Inf,error = function(e) NULL)
which basically says if the likelihood is Inf, throw an error. But what I
want it to do is just go to
4 matches
Mail list logo