clapply: Conditional 'lapply'

clapplyR Documentation

Conditional lapply

Description

Use lapply if the input is a list and otherwise apply the function directly to the input and wrap the result in a list. The function is implemented as

    if (is.list(X)) lapply(X, FUN, ...) else list(FUN(X, ...))

Usage

clapply(X, FUN, ...)

Arguments

X

a list or a single R object on which to apply FUN.

FUN

the function to be applied to (each element of) X.

...

optional arguments to FUN.

Value

a list (of length 1 if X is not a list).


surveillance documentation built on Nov. 2, 2023, 6:05 p.m.