View source: R/time-volume-weights.R
| time_volume_weights | R Documentation |
Aggregates numeric volume columns row-wise and converts the aggregate volume profile into non-negative time weights.
time_volume_weights(
volume_df,
date_col = NULL,
alpha = 1,
normalize = TRUE,
eps = 1e-08,
winsorize = FALSE,
winsor_q = 0.99
)
volume_df |
A data frame containing one or more numeric volume columns. |
date_col |
Optional name of a date column to exclude from the numeric volume aggregation and use as output names. |
alpha |
Non-negative exponent applied to aggregate volume scores. Values below 1 compress high-volume observations; values above 1 emphasize them. |
normalize |
Logical. If |
eps |
Small positive offset added before exponentiation. |
winsorize |
Logical. If |
winsor_q |
Quantile used as the cap when |
A numeric vector of weights, named by date_col when supplied.
vol <- data.frame(day = as.Date("2024-01-01") + 0:2, a = c(10, 20, 30), b = c(5, 5, 10))
time_volume_weights(vol, date_col = "day")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.