calculate_los: Calculate CMAM length of stay and median length of stay for a...

View source: R/length_of_stay.R

calculate_losR Documentation

Calculate CMAM length of stay and median length of stay for a cohort of CMAM discharges

Description

Calculate CMAM length of stay and median length of stay for a cohort of CMAM discharges

Usage

calculate_los(admission_date, discharge_date)

calculate_los_median(admission_date, discharge_date, group = NULL)

Arguments

admission_date

Date of admission in YYYY-MM-DD format. If child is a kwashiorkor case, date of lowest weight (when oedema has subsided). Can be a single date value or a vector of date values.

discharge_date

Date of discharge in YYYY-MM-DD format. Can be a single date value or a vector of date values.

group

A character value/s with the same length as admission_date and discharge_data to use as grouping variable within which median length-of-stay is to be calculated. Default is NULL for no grouping.

Value

Numeric value or vector of numeric values for length-of-stay in days for calculate_los(). A numeric value for median length-of-stay in days for calculate_los_median(). If group is not NULL, a vector of numeric values for median length-of-stay in days with length equal to the number of groups.

Author(s)

Ernest Guevarra

Examples

calculate_los(admission_date = "2010-03-15",
              discharge_date = "2010-06-14")

calculate_los(admission_date = c("2010-03-15", "2010-03-16"),
              discharge_date = c("2010-06-14", "2010-06-20"))

calculate_los_median(
  otp_beneficiaries$admDate,
  otp_beneficiaries$disDate,
  group = otp_beneficiaries$locality
)


ernestguevarra/squeacr documentation built on Dec. 21, 2024, 12:05 p.m.