p_comment {dtrackr} | R Documentation |
Add a generic comment to the dtrackr history graph
Description
A comment can be any kind of note and is added once for every current
grouping as defined by the .message
field. It can be made context specific
by including variables such as {.count} and {.total} in .message
which
refer to the grouped and ungrouped counts at this current stage of the
pipeline respectively. It can also pull in any global variable.
Usage
p_comment(
.data,
.messages = .defaultMessage(),
.headline = .defaultHeadline(),
.type = "info",
.asOffshoot = (.type == "exclusion"),
.tag = NULL
)
Arguments
.data |
a dataframe which may be grouped |
.messages |
a character vector of glue specifications. A glue specification can refer to any grouping variables of .data, or any variables defined in the calling environment, the {.total} of all rows, the {.count} variable which is the count in each group and {.strata} a description of the group |
.headline |
a glue specification which can refer to grouping variables
of .data, or any variables defined in the calling environment, or the
{.total} variable (which is |
.type |
one of "info","...,"exclusion": used to define formatting |
.asOffshoot |
do you want this comment to be an offshoot of the main flow (default = FALSE). |
.tag |
if you want the summary data from this step in the future then give it a name with .tag. |
Value
the same .data dataframe with the history graph updated with the comment
Examples
library(dplyr)
library(dtrackr)
iris %>% track() %>% comment("hello {.total} rows") %>% history()