dts_distribution: Distribution

View source: R/distribution.R

dts_distributionR Documentation

Distribution

Description

Calculates distribution by DateTime.

Usage

dts_distribution(
  x,
  dtt = "DateTime",
  colname = "Distribution",
  units = "days",
  normalize = TRUE,
  .dts_fun = "dnorm",
  .timing,
  ...
)

Arguments

x

A dts data frame

dtt

A string specifying the column with the Date or POSIXct values.

colname

A character vector specifying the column(s) with the other values.

units

A string of the time units for the variation (3rd and more) arguments of .dts_fun.

normalize

A flag indicating whether to normalize the values (ensure they sum to 1) or the proportion of the summed values to retain before renormalizing.

.dts_fun

A string of the name of a function which takes a numeric vector as its first argument (the values to calculate the distribution for), a numeric scalar as it second argument (the timing of the event) and one or more numeric scalars (representing the variation in the timing of the event).

.timing

A Date or POSIXct vector each element of which will be converted into a numeric value to be passed as the second argument to .dts_fun.

...

Additional arguments passed as named arguments to .dts_fun which should all be numeric vectors of the same length as .dtt or numeric scalars (which are reused).

Details

The date time values in x are converted into a numeric vector and passed as the first argument to .dts_fun.

Value

The modified DateTime series data frame with a column of the distribution.

See Also

normalize

Examples

dts_distribution(dts_data[1:10,], .timing = dts_data$DateTime[2], sd = 2, units = "hours")

poissonconsulting/dts documentation built on March 10, 2024, 6:21 a.m.