geom_mean | R Documentation |
Geometric Mean This functions creates a geometric mean of a numeric vector.
geom_mean(x, roll_window = length(x))
x |
numeric vector or dataframe column. |
roll_window |
numeric - length of the vector, or can be used to build a rolling geometric mean. |
Returns the geometric mean of a vector, or one number.
library(tibbletime)
library(purrr)
geom_mean_3 <- purrr::partial(geom_mean, roll_window = 3)
geom_mean_roll_3 <- tibbletime::rollify(geom_mean_3,window = 3)
data <- c(20,25,38,15,70)
geom_mean(data)
geom_mean_roll_3(data)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.