R/helper-functions.R

Defines functions make_propn_sex

make_propn_sex <- function(sex_ratio) {
    check_positive_numeric(value = sex_ratio,
                           name = "sex_ratio")
    pr_male <- sex_ratio / (100 + sex_ratio)
    values <- c(1 - pr_male, pr_male)
    labels <- c("Female", "Male")
    dembase::ValuesOne(values,
                       labels = labels,
                       name = "sex")
}
johnrbryant/agesim documentation built on Dec. 31, 2021, 11:56 a.m.