Thank you - I did mean tryCatch.
Bill Dunlap
TIBCO Software
wdunlap tibco.com
On Fri, Apr 28, 2017 at 10:01 AM, Bert Gunter
wrote:
> Typo: last line should be
>
> Even better, use
> p3p <- tryCatch(list(...), error=function(e) list())
>
>
> Cheers,
>
> Bert
>
>
> Bert
Typo: last line should be
Even better, use
p3p <- tryCatch(list(...), error=function(e) list())
Cheers,
Bert
Bert Gunter
"The trouble with having an open mind is that people keep coming along
and sticking things into it."
-- Opus (aka Berkeley Breathed in his "Bloom County" comic strip )
ifelse's vectorization messes this up.
You could replace your original
if (class(try(list(...), silent=TRUE))=="try-error") p3p <- list() else
p3p <- list(...)
with
p3p <- if (class(try(list(...), silent=TRUE))=="try-error") list() else
list(...)
instead of using ifelse, since the return
Dear list-members,
During the test phase of a function, I run it interactively (in Rstudio)
and the ... produces an error. Then I use this to read it:
if (class(try(list(...), silent=TRUE))=="try-error") p3p <- list() else
p3p <- list(...)
It works fine; interactively I will get
> if
4 matches
Mail list logo