state_getval: Get the state value kept in last call.

View source: R/state_getval.R

state_getvalR Documentation

Get the state value kept in last call.

Description

Get the state value kept in last call to the transformation function.

Usage

state_getval(initval)

Arguments

initval

If no state was kept, then this init value is returned.

Details

Transformation functions (e.g. lp, fs, bspline) can need to keep a state value between calls, e.g. when new data arrives and must be transformed. This function is used to getting the state values set in last call to the function.

Uses the input_class$state_getval().

Value

The state value, but if not found, then the initval.

See Also

state_setval() for setting the state value and input_class.

Examples


# See how it can be used in lp, which needs to save the state of the filter
# Note how it is not needed to do anything else than getting and setting the state
# in transformations (model$transform_data()), then multiple transformation functions can be called,
# but they are always in the same order, so the state (set,get) functions keep a counter internally
# to make sure that the correct values are set and returned when called again.
lp



onlineforecast documentation built on Oct. 12, 2023, 5:15 p.m.