Skip to main content

interp_rapply

Function interp_rapply 

Source
fn interp_rapply(
    positional: &[RValue],
    named: &[(String, RValue)],
    context: &BuiltinContext<'_>,
) -> Result<RValue, RError>
Expand description

Recursively apply a function to elements of a (nested) list.

When classes is specified, only leaf elements whose type matches one of the given class names are transformed by f. Non-matching leaves are replaced by deflt (or left unchanged in “replace” mode).

@param object a list (possibly nested) @param f function to apply to matching leaf elements @param classes character vector of class names to match (default: “ANY” matches all) @param deflt default value for non-matching leaves (used with “unlist”/“list” modes) @param how one of “unlist” (default), “replace”, or “list” @return depends on how: “unlist” returns a flat vector, “replace” returns a list with the same structure, “list” returns a flat list of results