R/utils.R

Defines functions check_sex

#' @title Check if sex is either male or female
#'
#' @description
#' \lifecycle{stable}
#'
#' Utility function for checking if the provided sex is either
#' male of female. Setting the right sex is in a lot of cases required and will
#' influence calculations. This function is only for internal use.
#'
#' @param sex sex; either male or female
#'
#' @return sex as non-capitalized verb
#'
#' @examples
#' check_sex("male")
#' check_sex("female")
#' @rdname check_sex
#' @importFrom checkmate assert_choice
#' @keywords internal
#' @noRd
check_sex <- function(sex) {
  choices <- c("male", "female")
  checkmate::assert_choice(sex, choices)
  return(sex)
}
MarijnJABoer/befitteR documentation built on April 24, 2020, 5:43 a.m.