Description Format Methods Examples
CMA creates a streaming algorithm that can be used to
keep track of the mean of incoming values.
An R6Class generator object
new()Creates a new CMA streamer object.
CMA$new(x = NULL)
xvalues to be used during initialisation (optional)
The new CMA (invisibly)
mean <- CMA$new()
update()Resets the CMA streamer object.
CMA$update(x)
xvalues to be added to the stream
The updated CMA (invisibly)
mean <- CMA$new() mean$update(c(1, 2))
clone()The objects of this class are cloneable with this method.
CMA$clone(deep = FALSE)
deepWhether to make a deep clone.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | mean <- CMA$new(c(1, 2))
mean$update(c(3, 4))
mean$value
#> [1] 2.5
## ------------------------------------------------
## Method `CMA$new`
## ------------------------------------------------
mean <- CMA$new()
## ------------------------------------------------
## Method `CMA$update`
## ------------------------------------------------
mean <- CMA$new()
mean$update(c(1, 2))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.