smart.mode.is.RdDetermine which of three modes the smart prediction is currently in.
smart.mode.is(mode.arg = NULL)If mode.arg is given, then either TRUE or FALSE
is returned.
If mode.arg is not given, then the mode ("neutral",
"read" or "write")
is returned. Usually, the mode is "neutral".
Smart functions such as
bs and
poly need to know what mode
smart prediction is in. If it is in "write" mode
then the parameters are saved to .smart.prediction
using put.smart. If in "read" mode
then the parameters are read in using get.smart.
If in "neutral" mode then the smart function behaves like an
ordinary function.
print(sm.min1)
#> function (x)
#> {
#> x <- x
#> minx <- min(x)
#> if (smart.mode.is("read")) {
#> smart <- get.smart()
#> minx <- smart$minx
#> }
#> else if (smart.mode.is("write"))
#> put.smart(list(minx = minx))
#> minx
#> }
#> <bytecode: 0x56035d6c4720>
#> <environment: namespace:VGAM>
#> attr(,"smart")
#> [1] TRUE
smart.mode.is() # Returns "neutral"
#> [1] "neutral"
smart.mode.is(smart.mode.is()) # Returns TRUE
#> [1] TRUE