Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

bptry

Try expression evaluation, recovering from bperror signals


Description

This function is meant to be used as a wrapper around bplapply() and friends, returning the evaluated expression rather than signalling an error.

Usage

bptry(expr, ..., bplist_error, bperror)

Arguments

expr

An R expression; see tryCatch.

bplist_error

A ‘handler’ function of a single argument, used to catch bplist_error conditions signalled by expr. A bplist_error condition is signalled when an element of bplapply and other iterations contain a evaluation that failed. When missing, the default retrieves the “result” attribute from the error, containing the partially evaluated results.

Setting bplist_error=identity returns the evaluated condition.

Setting bplist_error=stop passes the condition to other handlers, notably the handler provided by bperror.

bperror

A ‘handler’ function of a single argument, use to catch bperror conditions signalled by expr. A bperror is a base class to all errors signaled by BiocParallel code. When missing, the default returns the condition without signalling an error.

...

Additional named handlers passed to tryCatch(). These user-provided handlers are evaluated before default handlers bplist_error, bperror.

Value

The partially evaluated list of results.

Author(s)

See Also

Examples

param = registered()[[1]]
param
X = list(1, "2", 3)
bptry(bplapply(X, sqrt))                         # bplist_error handler
bptry(bplapply(X, sqrt), bplist_error=identity)  # bperror handler

BiocParallel

Bioconductor facilities for parallel evaluation

v1.24.1
GPL-2 | GPL-3
Authors
Bioconductor Package Maintainer [cre], Martin Morgan [aut], Valerie Obenchain [aut], Michel Lang [aut], Ryan Thompson [aut], Nitesh Turaga [aut], Aaron Lun [ctb]
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.