View source: R/vec-running-quantile.R
running_quantile | R Documentation |
The running_quantile
function calculates the quantile of
a vector over a sliding window, allowing for various alignment and rule options.
running_quantile(
.x,
.window,
.probs = 0.5,
.type = 7,
.rule = "quantile",
.align = "center"
)
.x |
A numeric vector for which the running quantile is to be calculated. |
.window |
An integer specifying the size of the sliding window. |
.probs |
A numeric value between 0 and 1 indicating the desired quantile probability (default is 0.50). |
.type |
An integer from 1 to 9 specifying the quantile algorithm type (default is 7). |
.rule |
A character string indicating the rule to apply at the edges of the window. Possible choices are:
|
.align |
A character string specifying the alignment of the window ("center", "left", or "right"; default is "center"). |
This function computes the running quantile of a numeric vector using a specified window size and probability.
A numeric vector containing the running quantile values.
Steven P. Sanderson II, MPH
Other Utility Functions:
convert_snake_to_title_case()
,
generate_caption()
,
get_attributes()
,
rand_walk_helper()
,
std_cum_max_augment()
,
std_cum_mean_augment()
,
std_cum_min_augment()
,
std_cum_prod_augment()
,
std_cum_sum_augment()
# Example usage of running_quantile
set.seed(123)
data <- cumsum(rnorm(50))
result <- running_quantile(data, .window = 3, .probs = 0.5)
print(result)
plot(data, type = "l")
lines(result, col = "red")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.