add_group.Rd
add_group()
allows for the injection of aggregation into the transformation
pipeline. Should you need to apply a transformation under aggregation (e.g.
add_shuffle
) this helper creates a grouped data.frame
as would be done
with dplyr::group_by()
.
The function add_ungroup()
is supplied to perform the inverse operation.
add_group(object, ...)
add_ungroup(object, ...)
A 'DeidentList' representing the untrained transformation pipeline. The object contains fields:
deident_methods
a list of each step in the pipeline (consisting of variables
and method
)
and methods:
mutate
apply the pipeline to a new data set
to_yaml
serialize the pipeline to a '.yml' file
pipe.grouped <- add_group(ShiftsWorked, Date, Shift)
pipe.grouped_shuffle <- add_shuffle(pipe.grouped, `Daily Pay`)
add_ungroup(pipe.grouped_shuffle, `Daily Pay`)
#> DeidentList
#> 3 step(s) implemented
#> Step 1 : 'Grouper(group_on = [Date, Shift])' on variable(s)
#> Step 2 : 'Shuffler' on variable(s) Daily Pay
#> Step 3 : 'Ungrouper' on variable(s) Daily Pay
#> For data:
#> columns: Record ID, Employee, Date, Shift, Shift Start, Shift End, Daily Pay