bin: Bin a dataset with multiple columns by one of the columns.

Description Usage Arguments

Description

Bin a dataset with multiple columns by one of the columns.

Usage

1
2
3
bin(dt, bin.size, by, bin.average.function = mean.narm, interpolate = T,
  remove.na = T, time.sampled.at = "mid", start = NULL, end = NULL,
  add.binning.info = F)

Arguments

dt

A data frame containing the data to be binned.

bin.size

The size of the bins

by

The name of the column to bin by.

bin.average.function

The function to use for averaging bins. Default is the arithmetic mean.

interpolate

Should empty bins be interpolated linearly?

remove.na

Should NAs remaining after interpolation (usually at endpoints after interpolatin) be removed? BEWARE: be careful about removing nans before interpolating.

time.sampled.at

How time indices are constructed. Either 'start', 'mid' or 'end' of bins. Defaults to 'mid'.

start

The minimum value of the 'by' column for which to subset data. Defaults to the first lower bin limit < min(dt[, by]), obeying bin.size.

end

The maximum value of the 'by' column for which to subset data. Defaults to the first upper bin limit > max(dt[, by]), obeying bin.size.

add.binning.info

Should info on the binning be added to the resulting dataframe?


kahaaga/tstools documentation built on May 24, 2019, 5:01 a.m.