popcount: Counting population and person-time in the joint...

View source: R/popcount.R

popcountR Documentation

Counting population and person-time in the joint PHA/Medicaid/Medicare data

Description

popcount summarizes population data in the joint PHA/Medicaid/Medicare data.

Usage

popcount(
  df,
  group_var = quos(agency_new),
  agency = NULL,
  enroll = NULL,
  unit = NULL,
  startdate = NULL,
  enddate = NULL,
  birth = NULL,
  length = NULL,
  numeric = TRUE,
  wc = FALSE,
  wc_min = 0,
  wc_max = 6,
  ...
)

Arguments

df

A data frame

group_var

A set of variables to group counts by. Default is PH agency. Must be set as a quosure (use quos(<group1>, <group2>))

agency

A named variable that specifies the agency a person is in for that period of time (usually KCHA, SHA, or NA/Medicaid/Medicare only). Used to allocate individuals who moved between multiple agencies/enrollment types in the period. Default is pha_agency.

enroll

A named variable that specifies the type of enrollment a person is in for that period of time (field should contain the following codes: "m" = Medicaid only, "b" = housing and Medicaid, or "h" = housing only). Used to allocate individuals who moved between multiple agencies/enrollment types in the period. Default is enroll_type.

unit

A named variable that determines the unit to count over. Default unit of analysis is pid2 (individuals) but pid should be used with data not matched to Medicaid. The other option is hhold_id_new for households.

startdate

A string that specifies the variable name for the time an individual or household starts at that address/program. Default is set for the linked PHA/Medicaid data (startdate_c) but if that is not present then the next default is startdate.

enddate

A string that specifies the variable name for the time an individual or household ends participation at that address/program. Default is set for the linked PHA/Medicaid data (enddate_c) but if that is not present then the next default is enddate.

birth

A named variable that determines which date of birth field to use when calculating age (normally dob_c or dob_h but can also use hh_dob_m6 if calculating age at the household level). Only needed if using an age grouping or the well-child flag.

length

A named variable that determines which start date to use when calculating length of time in housing (normally start_housing).

numeric

Determine whether to recode age and length of time groups to be numeric or remain as character.

wc

Choose whether to just run pop counts for the well-child indicator age group (ages 3-6 years)

wc_min

Minimum age (inclusive) for inclusion in the well child check indicator

wc_max

Maximum age (inclusive) for inclusion in the well child check indicator

...

Additional arguments for the time_range function (yearmin, yearmax, period, and date).

Details

This function takes the date range supplied by time_range and counts individuals enrolled and person time by group. The function works for PHA data regardless of whether or not it has also been matched to Medicaid/Medicare data.

Examples

## Not run: 
popcount(pha_longitudinal)
popcount(pha_longitudinal, group_var = quos(agency_new, major_prog),
agency = "kcha", unit = hhold_id_new)
popcount(pha_longitudinal, yearmin = 2014, yearmax = 2016, period = "month")

## End(Not run)


PHSKC-APDE/Housing documentation built on Feb. 6, 2024, 3:27 a.m.