Filter data based on clients and validate
filter_data.Rdfilter_data() filters the provided dataset to include only records that match
the given clients_filtered dataset at the specified level (enrollment or youth).
It then validates the filtered dataset to ensure it is not empty.
Arguments
- data
A data frame to be filtered
- clients_filtered
A data frame containing the client records to filter
databy. Must contain columns that match the selectedatlevel.- at
A character string specifying the filtering level. Either
"enrollment"(default) or"youth"."enrollment": Filters data based onpersonal_id,organization_idandenrollment_id."youth": Filters data based onpersonal_idandorganization_id.