BinTimeseries: Bin a Timeseries Preserving Empty Bins

View source: R/SpecACF.R

BinTimeseriesR Documentation

Bin a Timeseries Preserving Empty Bins

Description

Convert a continuous time series to a discrete (regular) timeseries by binning, preserving any empty bins. Additionally returns the number of data points in each bin

Usage

BinTimeseries(
  time.var,
  value.var,
  bin.width,
  strt.time = NULL,
  end.time = NULL
)

Arguments

time.var

time variable, a vector

value.var

value variable, a vector

bin.width

with of time bins in output

strt.time

first time value in output, defaults to min(time.var) - bin.width/2

end.time

last time values in output, defaults to max(time.var) + bin.width/2

Value

a dataframe

Author(s)

Andrew Dolman <andrew.dolman@awi.de>

Examples

set.seed(20230312)
x <- cumsum(rgamma(20, shape = 1.5, rate = 1.5/10))
y <- SimProxySeries(a = 0.1, b = 1, t.smpl = x)
BinTimeseries(x, y, bin.width = 15)

EarthSystemDiagnostics/paleospec documentation built on Feb. 17, 2024, 4:36 p.m.