random_state | R Documentation |
This function draws a sample from a user-defined frequency distribution for a categorical variable.
random_state(states, probs)
states |
character vector containing state names. |
probs |
numeric vector containing probabilities for the states. If these do not add up to 1, they are automatically normalized. |
one of the states, drawn randomly according to the specified probabilities.
Eike Luedeling
random_state(states=c("very low","low","medium","high","very high"),
probs=c(1,1,2,1,1))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.