Custodial data flagging function
aducust_flag.Rd
This function serves to flag whether a custodial record exists when a child is of a certain stage.
Usage
aducust_flag(
data,
dobmap,
carer_map,
child_id_var = "rootnum",
carer_id_var = "carer_rootnum",
data_start_date = "ReceptionDate",
data_end_date = "DischargeDate",
dobmap_dob_var = "dob",
child_start_age = 0,
child_end_age = 18,
carer_summary = FALSE,
any_carer_summary = FALSE
)
Arguments
- data
Input dataset (carer aducust).
- dobmap
DOBmap file at the child level.
- carer_map
Mapping file with columns "child ID", "carer ID". Can have multiple rows per child (e.g., one per carer 1, carer 2, NEWBMID).
- child_id_var
Variable denoting "child ID". Must exist and be called the same thing in
dobmap
andcarer_map
. Default"rootnum"
.- carer_id_var
Variable denoting "carer ID". Must exist in
carer_map
. Default"carer_rootnum"
.- data_start_date
Start date to consider in
data
. Corresponds to aducust start date. Default"ReceptionDate"
.- data_end_date
End date to consider in
data
. Corresponds to aducust end date. Default"DischargeDate"
.- dobmap_dob_var
Date of birth (DOB) varible in
dobmap
. Default"dob"
.- child_start_age
Numeric. Start (minimum) age (years) to consider for flagging (default
0
).- child_end_age
Numeric. End (maximum) age (years) to consider for flagging (default
18
).- carer_summary
Collapse aducust flags within carer (i.e., for each
carer_id_var
). DefaultFALSE
.- any_carer_summary
Collapse aducust flags across carers. Default
FALSE
.
Details
For more details, see the vignette.
Note
If
carer_summary
isTRUE
, then we are flagging whether a specific carer has any aducust record.Therefore, we are assessing whether a specific carer has any aducust records.
If
any_carer_summary
isTRUE
, then we are flagging whether any carer (if multiple) have any aducust records.If
any_carer_summary
isTRUE
,carer_summary
will be ignored.