binning function for time series
CAUTION! REQURIES DPLYR 0.7.0
Install using:
devtools::install_github("rosseji/timemerge")
Example call:
df_binned <- binner(df = df_coff,
date_var = Item.Time.Created.date,
cat_var = Item.Name,
val_var = Prices,
interval = "hour")
ggplot(df_binned, aes(x = bin_id, y = Total, colour = Item.Name)) +
geom_line()
Has a new argument method
to specify the math:
df_binned <- binner(df = df_coff,
date_var = Item.Time.Created.date,
cat_var = Item.Name,
val_var = Prices,
interval = "hour",
method = "avg")