group_modify.trackr_df {dtrackr} | R Documentation |
Group-wise modification of data and complex operations
Description
Group modifying a data set acts in the normal way. The internal mechanics of
the modify function are opaque to the history. This means these can be used
to wrap any unsupported operation without losing the history (e.g. df %>% track() %>% group_modify(function(d,...) { d %>% unsupported_operation() })
) Prior to the operation the size of the group is calculated {.count.in}
and after the operation the output size {.count.out} The group {.strata}
is also available (if grouped) for reporting See dplyr::group_modify()
.
Usage
## S3 method for class 'trackr_df'
group_modify(
.data,
...,
.messages = NULL,
.headline = .defaultHeadline(),
.type = "modify",
.tag = NULL
)
Arguments
.data |
A grouped tibble |
... |
Additional arguments passed on to |
.messages |
a set of glue specs. The glue code can use any global variable, or {.strata},{.count.in},and {.count.out} |
.headline |
a headline glue spec. The glue code can use any global variable, or {.strata},{.count.in},and {.count.out} |
.type |
default "modify": used to define formatting |
.tag |
if you want the summary data from this step in the future then give it a name with .tag. |
Value
the transformed .data dataframe with the history graph updated.
See Also
dplyr::group_modify()
Examples
library(dplyr)
library(dtrackr)
tmp = iris %>% track() %>% group_by(Species)
tmp %>% group_modify(
function(d,g,...) { return(tibble::tibble(x=runif(10))) },
.messages="{.count.in} in, {.count.out} out"
) %>% history()