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().

# S3 method for trackr_df
group_modify(
  .data,
  ...,
  .messages = NULL,
  .headline = .defaultHeadline(),
  .type = "modify",
  .tag = NULL
)

Arguments

.data

A grouped tibble

...

Additional arguments passed on to .f

.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()
#> dtrackr history:
#> number of flowchart steps: 3 (approx)
#> tags defined: <none>
#> items excluded so far: <not capturing exclusions>
#> last entry / entries:
#> ├ [Species:setosa]: "Species:setosa", "50 in, 10 out"
#> ├ [Species:versicolor]: "Species:versicolor", "50 in, 10 out"
#> └ [Species:virginica]: "Species:virginica", "50 in, 10 out"