selecting_dots: tags to modify content of dots

Description Usage Arguments Examples

Description

tags inspired by dplyr functions to modify the dots of the call

Usage

1
2
3
4
5
6
7
8
9

Arguments

...vars

A list of columns generated by vars()

...exprs

A list of expressions generated by exprs()

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
## Not run: 
library(dplyr)
library(purrr)
library(rlang)
# the functions can be used in regular calls
reversing_dots$paste0("a", "b")

selecting_dots(vars(b2,starts_with("a")))$
  transform(head(cars,2), a1 = 1, b1 = 2, a2 = 3, b2 = speed *100)

mutating_dots(exprs(foo = 1000 * bar))$
  mutate(head(cars,2), bar = speed * 10)

# or with forwarded dots
fun <- function(...){
  print(
    selecting_dots(vars(b2,starts_with("a")))$
      mutate(head(cars,2), ...))
  print(
    renaming_dots(vars(foo = a1))$
      mutate(head(cars,2), ...))
  print(
    mutating_dots(exprs(a2 = 100*a2 + a1, foo = 1000 * b1))$
      mutate(head(cars,2), ...))
  print(
    transmuting_dots(exprs(a2 = 100*a2 + a1, foo = 1000 * b1))$
      mutate(head(cars,2), ...))
  print(
    reversing_dots$mutate(head(cars,2), ...))
}
fun(a1 = 1, b1 = 2, a2 = 3, b2 = 40)

## End(Not run)

moodymudskipper/tags documentation built on June 25, 2019, 10:54 a.m.