Commit d5966204 authored by Facundo Muñoz's avatar Facundo Muñoz ®️
Browse files

risk_table(): return integer values for risk categories

- otherwise, level labels get exported as strings of the form (a, b].

- also, fix example
parent 675b1040
......@@ -80,10 +80,10 @@ risk_plot <- function(x, v, n) {
#' @examples
#' epi_units <- mapMCDA_datasets()$cmr_admin3
#' risk <- runif(nrow(epi_units), 0, 100)
#' risk_unit_table(epi_units, risk, n = 4)
#' risk_table(epi_units, risk, n = 4)
risk_table<- function(x, v, n) {
x$risk <- v
x$risk_cat <- cut(v, n)
x$risk_cat <- cut(v, n, labels = FALSE)
return(data.frame(x))
}
......@@ -23,5 +23,5 @@ categorised into n risk-levels
\examples{
epi_units <- mapMCDA_datasets()$cmr_admin3
risk <- runif(nrow(epi_units), 0, 100)
risk_unit_table(epi_units, risk, n = 4)
risk_table(epi_units, risk, n = 4)
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment