yt_popcode | R Documentation |
yt_popcode
assigns people in the SHA data to a demographic group.
yt_popcode(
df,
year = 12,
year_pre = "pt",
year_suf = NULL,
agency = NULL,
enroll_type = NULL,
dual = NULL,
yt = NULL,
ss = NULL,
pt_cut = 30,
min = T
)
df |
A data frame |
year |
An integer that describes the calendar year being examined. Used to identify the person-time variable. |
year_pre |
A string that prefixes the year in the person-time variable. |
year_suf |
A string that suffixes the year in the person-time variable. |
agency |
A named variable that specifies the agency. |
enroll_type |
A named variable that specifies the enrollment type. |
dual |
A named variable that specifies a person's dual eligibility. |
yt |
A named variable that specifies the Yesler Terrace flag. Must be binary (0/1). |
ss |
A named variable that specifies the scattered sites flag. Must be binary (0/1). |
pt_cut |
The threshold in person-days a person should meet in order to be considered at YT/SS in that year |
min |
Flag to keep the minimum pop_code. |
This function is specific to Seattle Housing Authority's data. It assigns a numeric code to each row in the data where person-time has accumulated for that calendar year. Codes are assigned as follows: (#1-5 assume simultaneous Medicaid enrollment and not dual eligible): 1) At least 30 days at YT that year = YT, 2) No YT but 30+ days at SS that year = SS, 3) No YT or SS but in SHA for 30+ days = SHA, 4) Not YT/SS/SHA but in KCHA for 30+ days = KCHA, 5) No 30+ days in any PHA = non-PHA Medicaid, 6-10) Same as #1-5 but only dual eligible, 11-15) Same as #1-5 but dual eligible is NA, 16-18) Only time in SHA (+/- YT and SS) and no Medicaid, 19) Only time in KCHA and no Medicaid
If the min flag is true, only takes the smallest numeric code produced is kept for that year and new demographic variables are calculated. Taking the smallest code prioritizes a person's time at Yesler Terrace when they were also enrolled in Medicaid.
It is assumed that the df has variables for housing authority, enrollment
type, dual eligibility, and person-time for that calendar year. Also assumes
that yt_flag
has been run to identify people living at YT
or scattered sites.
Eventually could expand to accommodate non-calendar years using the
time_range
function.
## Not run:
yt_popcode(yt_mcaid_final, year_pre = "pt", year = 12, min = T)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.