# Generated by fusen: do not edit by hand
#' bmi Body Mass Index of an individual
#'
#' @param mass in kg
#' @param height in m
#' @return bmi as mass/(height * height)
#' @importFrom assertthat assert_that
#' @importFrom dplyr mutate
#' @export
#'
#' @examples
#' bmi(mass = 80, height = 1.80)
#' bmi(mass = NA, height = 1.80)
#' bmi(mass = 80, height = NA)
#' bmi(mass = NA, height = NA)
bmi <- function(mass, height) {
if(!(is.na(mass)|(is.numeric(mass)&mass>0))) {stop("mass should be numeric and >0")}
if(!(is.na(height)|(is.numeric(height)&height>0))) {stop("height should be numeric and >0")}
bmi <- NA
if (!is.na(mass)&!is.na(height)) {
bmi <- mass/(height * height)
}
return(bmi)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.