Description Format Methods Examples
Variance creates a streaming algorithm that can be
used to calculate the population and sample variance of incoming values
An R6Class generator object
new()Creates a new Variance streamer object.
Variance$new(x = NULL, sample = FALSE)
xvalues to be used during initialization (optional)
The new Variance (invisibly)
variance <- Variance$new()
update()Updates the Variance with a stream of new values
Variance$update(x)
xa vector of values to update the Variance
samplefor choosing between the population and sample variance. If 'TRUE' the sample variance is returned. If 'FALSE' the population variance is returned.
The updated Variance (invisibly)
variance <- Variance$new(c(1,2)) variance$update(c(3,4))
clone()The objects of this class are cloneable with this method.
Variance$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 | variance <- Variance$new(c(1, 2))
variance$update(c(3, 4))
variance$value
#> [1] 1.25
## ------------------------------------------------
## Method `Variance$new`
## ------------------------------------------------
variance <- Variance$new()
## ------------------------------------------------
## Method `Variance$update`
## ------------------------------------------------
variance <- Variance$new(c(1,2))
variance$update(c(3,4))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.