S4 getter and replacement methods for the timesteps slot on a
SeverityEstimateModel, plus a chainable set_timesteps()
helper for pipeline ergonomics.
Usage
timesteps(x)
timesteps(x) <- value
# S4 method for class 'SeverityEstimateModel'
timesteps(x)
has_timesteps(x)
# S4 method for class 'SeverityEstimateModel'
has_timesteps(x)
# S4 method for class 'SeverityEstimateModel'
timesteps(x) <- value
require_timesteps(model, mode = "error")
set_timesteps(model, name, levels = NULL)Arguments
Value
timesteps(x) returns the current timestep specification.
timesteps(x) <- value returns x modified to include the timestep
specification.
has_timesteps(x) returns TRUE if timesteps have been set, FALSE
otherwise.
require_timesteps(model, mode) returns model. If timesteps are unset, the
behavior depends on mode.
set_timesteps(model, ...) returns model modified to include the
timestep specification.
Examples
line_list <- data.frame(
patient = 1L:3L,
week = c(1L, 1L, 2L),
age = c("Youth", "Adult", "Senior"),
detection = c("Active", "Passive", "Active"),
outcome = c("Asymptomatic", "Death", "Symptomatic")
)
population <- data.frame(
age = c("Youth", "Adult", "Senior"),
amount = rep(987L, 3L)
)
model <- SeverityEstimateModel(line_list, population) |>
set_timesteps("week")
timesteps(model)
#> $name
#> [1] "week"
#>
#> $levels
#> [1] 1 2
#>