EddingtonModule {eddington} | R Documentation |
An Rcpp Module for Tracking Eddington Numbers for Cycling
Description
A stateful C++ object for computing Eddington numbers.
Arguments
rides |
An optional vector of values used to initialize the class. |
store_cumulative |
Whether to store a vector of the cumulative Eddington
number, as accessed from the |
Fields
new
Constructor. Parameter list may either be empty,
store_cumulative
, orrides
andstore_cumulative
current
The current Eddington number.
cumulative
A vector of Eddington numbers or
NULL
ifstore_cumulative
isFALSE
.hashmap
A
data.frame
containing the distances and counts above the current Eddington number.update
Update the class state with new data.
getNumberToNext
Get the number of additional distances required to reach the next Eddington number.
getNumberToTarget
Get the number of additional distances required to reach a target Eddington number.
Warning
EddingtonModule
objects cannot be serialized at this time; they cannot be
carried between sessions using base::saveRDS or base::save and then
loaded later using base::readRDS or base::load.
Examples
# Create a class instance with some initial data
e <- EddingtonModule$new(c(3, 3, 2), store_cumulative = TRUE)
e$current
# Update with new data and look at the vector of cumulative Eddington numbers.
e$update(c(3, 3, 5))
e$cumulative
# Get the number of rides required to reach the next Eddington number and
# an Eddington number of 4.
e$getNumberToNext()
e$getNumberToTarget(4)