mutatex: mutate/transmute with grouping

Description Usage Arguments Details Examples

Description

If .by is given, data is grouped just for mutate operation.

Usage

1
2
mutatex(.data, ..., .by = NULL, .rowwise = FALSE, .keep = c("all",
  "new"))

Arguments

.data

A tbl. All main verbs are S3 generics and provide methods for tbl_df(), dtplyr::tbl_dt() and dbplyr::tbl_dbi().

...

Name-value pairs of expressions. Use NULL to drop a variable.

These arguments are automatically quoted and evaluated in the context of the data frame. They support unquoting and splicing. See vignette("programming") for an introduction to these concepts.

.by

a vector or list of variables as characters or given by vars

.keep

if "new", transmute will be called instead of mutate

Details

Prefer standard grouping notation for a sequence of operations as it will be more efficient, but for a single operation this is not a costly alternative.

Examples

1
2
iris[c(1:2,51:52),] %>% mutatex(z= mean(Sepal.Length),.by= vars(Species))
iris[c(1:2,51:52),] %>% mutatex(z= mean(Sepal.Length),.by= "Species")

moodymudskipper/tidyx documentation built on May 17, 2019, 10:39 a.m.