moving_average | R Documentation |
Weighted moving average
moving_average(x, n = 3L, weights = NULL)
x |
A numeric vector. |
n |
The order of the moving average. |
weights |
Optional weights. |
A vector with the (weighted) moving average.
Other Machine Learning:
cross_validation_split()
,
decision_tree()
,
k_nearest_neighbors()
,
naive_bayes()
,
naive_forecast()
,
predict.decisiontree()
,
predict.kmeans()
,
predict.naivebayes()
x <- c(855, 847, 1000, 635, 346, 2146, 1328, 1322, 3124, 1012, 1280, 2435, 1016, 3465, 1107, 1172, 3432, 836, 142, 345, 2603, 739, 716, 880, 1008, 112, 361)
moving_average(x)
moving_average(x, weights = c(1L, 2L, 3L))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.