Scans a data.frame of minimum dataset assessments, assigns an indicator according to an arbitrary length of stay. 100 days with no more than 10 days out is a standard "long-stay" definition.

cpt_stay(mds_obj,
                .stay_min = 100L,
                .stay_maxout,
                .report=T)

Arguments

.stay_min

A integer of length one. The length of stay to flag. 100 days is the default.

.stay_maxout

A integer of length one. The maximum allowable days outside of nursing home. 10 days is default.

.report

A logical indicating a short report on cohort construction. Default is true.

mds_obj

A data.frame class object which is "mds canon". See ?mds_as_canon

.keep_all

A logical indicates whether to keep all the patients, or if false only those meeting .stay_* rules. Default is false.

Value

A dataframe with one row per resident, cohort entry, cohort exit, flag for rules equals T if .stay_* rules met,

References

ADD LATER

Examples

require(mdsR) mds_dta <- mdsR::mds_cohort
#> Error: 'mds_cohort' is not an exported object from 'namespace:mdsR'
longstay <- cpt_stay(mds_dta, .keep_all=T)
#> Error in cpt_stay(mds_dta, .keep_all = T): unused argument (.keep_all = T)