View source: R/ggplot-extensions.R
| gg_state_occupation | R Documentation |
Creates a stacked area plot of state occupation probabilities over time, computed from transition probability matrices stored as an attribute of the input data. Optionally facets by a grouping variable.
gg_state_occupation(
newdata,
init_state,
group_var = NULL,
time_var = "tend",
ncol = NULL
)
newdata |
A data frame with an attribute |
init_state |
A numeric vector specifying the initial state distribution.
Should sum to 1 and have length equal to the number of states. For example,
|
group_var |
A character string giving the name of the column in
|
time_var |
A character string giving the name of the time variable in
|
ncol |
An integer specifying the number of columns in the facet wrap.
If |
A ggplot object showing stacked-area state occupation
probabilities over time, optionally faceted by group_var.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.