rumba: Apply several functions to the same column

Description Usage Arguments Value Examples

View source: R/rumba.R

Description

Apply several functions to the same column

Usage

1
2
3
rumba(.var, ..., .tbl = get_tbl(), .name = NULL, .env = caller_env())

zumba(.var, ..., .tbl = get_tbl(), .name = NULL, .env = caller_env())

Arguments

.var

A variable specified as in dplyr::pull()

...

list of functions or formulas using . to refer to the column

.tbl, .env

data frame to get columns from and caller environment. Most of the time, you don't need to set these

.name

glue::glue() model to name the created columns. The model can use :

  • {fun} to refer to the function name

  • {idx} to refer to the index of the function with the given list

  • {var} to refer to the selected name The default uses "{fun}" is the ... list is named, and "fn{idx}" otherwise

Value

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
g <- group_by(iris, Species)

# ---- tango()
g %>%
  tango(rumba(Sepal.Length, mean = mean, median = median))

# select the first column, control the result names
# with the glue() model
g %>%
  tango(rumba(1, mean = mean, median = median, .name = "{var}_{fun}"))

g %>%
  tango(Sepal.Width = zumba(Sepal.Width, mean = mean, median = median))

# ---- jive()
g %>%
  jive(
    rumba(Sepal.Width, five = fivenum, quantile = quantile)
  )

romainfrancois/dance documentation built on Nov. 21, 2019, 11:49 a.m.