View source: R/create_twig_obj.R
event | R Documentation |
This function creates an event layer that can be added to a twig object. The event layer defines the possible outcomes of an event, their probabilities, and the transitions between states.
event(name, options, probs, transitions)
name |
A character string representing the name of the event. It doesn't need to be quoted. |
options |
A character vector of possible outcomes for the event. They don't need to be included in quotes. One of these options must be none. |
probs |
A character vector of probability function names for each outcome. They don't need to be included in quotes. One of these can be leftover for the remaining probability. |
transitions |
A character vector of state transitions corresponding to each outcome. They don't need to be included in quotes. These could be event names or states if a states layer defined. One of these can be stay for the Markov state to remain the same. |
A list representing the event layer.
#' # Adding the event layer to a twig object
twig_obj <- twig() + event(name = event_progress,
options = c(yes, none),
probs = c(pProgress, leftover),
transitions = c(Severe, stay))
event_layer <- event(name = "event_progress",
options = c("yes", "none"),
probs = c(pProgress, leftover),
transitions = c("Severe", "stay"))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.