nzapply: Apply a vectorized function to all nonzero elements of a...

Description Usage Arguments Details Value Examples

View source: R/nzapply.R

Description

nzapply applies a vectorized function to all nonzero elements of a vector.

Usage

1
nzapply(x, FUN, base = 0, ...)

Arguments

x

A vector.

FUN

A vectorized function.

base

What to return if all elements of x are zero.

...

Other arguments to pass to FUN

Details

Source:

http://stackoverflow.com/questions/12583569

Value

Returns the value of applying FUN to nonzero elements of x

Examples

1
2
mpuri:::nzapply(c(0, 1, 2, 3, 4), min)
mpuri:::nzapply(c(0, 0, 0, 0), max, base = NA)

sagun98/mpuri documentation built on Dec. 23, 2019, 6:32 p.m.