filter.trackr_df {dtrackr}R Documentation

Filtering data

Description

Filter acts in the same way as in dplyr where predicates which evaluate to TRUE act to select items to include, and items for which the predicate cannot be evaluated are excluded. For tracking prior to the filter operation the size of each group is calculated {.count.in} and after the operation the output size of each group {.count.out}. The grouping {.strata} is also available (if grouped) for reporting. See dplyr::filter().

Usage

## S3 method for class 'trackr_df'
filter(
  .data,
  ...,
  .messages = "excluded {.excluded} items",
  .headline = .defaultHeadline(),
  .type = "exclusion",
  .asOffshoot = (.type == "exclusion"),
  .stage = (if (is.null(.tag)) "" else .tag),
  .tag = NULL
)

Arguments

.data

A data frame, data frame extension (e.g. a tibble), or a lazy data frame (e.g. from dbplyr or dtplyr). See Methods, below, for more details.

...

<data-masking> Expressions that return a logical value, and are defined in terms of the variables in .data. If multiple expressions are included, they are combined with the & operator. Only rows for which all conditions evaluate to TRUE are kept.

.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

the format type of the action typically an exclusion

.asOffshoot

if the type is exclusion, .asOffshoot places the information box outside of the main flow, as an exclusion.

.stage

a name for this step in the pathway

.tag

if you want the summary data from this step in the future then give it a name with .tag.

Value

the filtered .data dataframe with history graph updated

See Also

dplyr::filter()

Examples

library(dplyr)
library(dtrackr)

tmp = iris %>% track() %>% group_by(Species)
tmp %>% filter(Petal.Length > 5) %>% history()

[Package dtrackr version 0.4.4 Index]