binvec: Binned Summaries of a Vector

View source: R/signal.R

binvecR Documentation

Binned Summaries of a Vector

Description

Summarize a vector in the bins at the specified indices.

Usage

binvec(x, lower, upper, stat = "sum", prob = 0.5)

Arguments

x

A numeric vector.

lower, upper

The (inclusive) lower and upper indices of the bins

stat

The statistic used to summarize the values in each bin. Must be one of "sum", "mean", "max", "min", "sd", "var", "mad", or "quantile".

prob

The quantile for stat = "quantile".

Value

An numeric vector of the summarized (binned) values.

Author(s)

Kylie A. Bemis

Examples

set.seed(1)

x <- sort(runif(20))

binvec(x, c(1,6,11,16), c(5,10,15,20))

binvec(x, seq(from=1, to=16, by=5), stat="mean")

kuwisdelu/matter documentation built on Oct. 19, 2024, 10:31 a.m.