iapply: Apply each elements with index as second input

View source: R/apply.R

iapplyR Documentation

Apply each elements with index as second input

Description

Apply function with an index variable as the second input.

Usage

iapply(X, FUN, ..., .method = c("sapply", "lapply", "vapply"))

Arguments

X

a vector (atomic or list)

FUN

the function to be applied to each element of X: see 'Details'.

...

passed to apply methods

.method

method to use, default is sapply

Details

FUN will be further passed to the apply methods. Unlike lapply, FUN is expected to have at least two arguments. The first argument is each element of X, the second argument is the index number of the element.

Value

a list or matrix depends on .method. See lapply


dipsaus documentation built on July 9, 2023, 5:43 p.m.