call_fn_ellipsis_deprecated: Call function using safe ellipsis arguments

call_fn_ellipsis_deprecatedR Documentation

Call function using safe ellipsis arguments

Description

Call function using safe ellipsis arguments

Usage

call_fn_ellipsis_deprecated(FUN, ...)

Arguments

FUN

function that should be called with arguments in ...

...

arguments are passed to FUN() in safe manner.

Details

This function is deprecated, instead please use jamba::call_fn_ellipsis().

This function is a wrapper function intended to help pass ellipsis arguments ... from a parent function to an external function in a safe way. It will only include arguments from ... that are recognized by the external function.

When the external function FUN arguments formals() includes ellipsis ..., then the ... will be passed as-is without change.

When the external function FUN arguments formals() does not include ellipsis ..., then only named arguments in ... that are recognized by FUN will be passed, as defined by names(formals(FUN)).

Note that arguments must be named.

Value

output from FUN() when called with relevant named arguments from ellipsis ...

See Also

Other jam utility functions: avg_angles(), avg_colors_by_list(), cell_fun_bivariate(), collapse_mem_clusters(), colorRamp2D(), deconcat_df2(), display_colorRamp2D(), enrichList2geneHitList(), filter_mem_genes(), filter_mem_sets(), find_colname(), get_hull_data(), get_igraph_layout(), gsubs_remove(), handle_igraph_param_list(), isColorBlank(), make_legend_bivariate(), make_point_hull(), mem_find_overlap(), order_colors(), rank_mem_clusters(), rotate_coordinates(), subgraph_jam(), subset_mem(), summarize_node_spacing(), xyAngle()

Examples

new_mean <- function(x, trim=0, na.rm=FALSE) {
   mean(x, trim=trim, na.rm=na.rm)
}
x <- c(1, 3, 5, NA);
new_mean(x, na.rm=TRUE);
# throws an error as expected (below)
# new_mean(x, na.rm=TRUE, color="red");

call_fn_ellipsis_deprecated(new_mean, x=x, na.rm=TRUE, color="red")
# throws an error as expected (below)
# call_fn_ellipsis_deprecated(new_mean, x=x, color="red")


jmw86069/jamenrich documentation built on Nov. 6, 2024, 7:07 p.m.