R/AdjustedMR.R

Defines functions AMR

library(tidyverse)
library(ggplot2)
library(rlang)

AMR <- function(Population, Deaths, perPopulation){

  if (sum(Deaths > Population)==length(Deaths)){
    rlang::catch_cnd(abort(message = "Expected deaths are greater than Population! Check for errors in the data source!",
                           .subclass = "death_overflow"
                           ))

  } else {
    if (missing(perPopulation)){
      perPopulation = 1000
    }
    (Deaths / (Population)) * perPopulation
  }
}
jaa249/moRtalityG7 documentation built on May 2, 2022, 12:42 p.m.