R/rv_create_risk_vector.R
rv_create_risk_vector.Rd
Create risk vector based on ratio, number of places, or data frame
rv_create_risk_vector( risk_ratio, total_places, risk_places = NULL, risk_names = NULL )
risk_ratio | A numeric vector or a data frame with two columns, `Risk` and `Ratio` |
---|---|
total_places | Numeric. Gives the total length of the output vector. |
risk_places | A numeric vector or a data frame with two columns, `Risk` and `Places` |
risk_name | If a numeric vector given in previous parameters, defines the name of the risk. |
A character vector with length equal to total_places.
rv_create_risk_vector(risk_ratio = 0.1, total_places = 100) table( rv_create_risk_vector(risk_ratio = 0.1, total_places = 100) )#> #> 1 #> 10ratio <- tibble::tribble(~Risk, ~Ratio, "Hospitalization", 0.3, "Death", 0.1) rv_create_risk_vector(risk_ratio = ratio, total_places = 100) table( rv_create_risk_vector(risk_ratio = ratio, total_places = 100) )#> #> Hospitalization Death #> 30 10