s_filter: Modified version of dplyr's filter that uses string arguments

Description Usage Examples

Description

Modified version of dplyr's filter that uses string arguments

Usage

1
s_filter(.data, ...)

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
## Not run: 
  # Examples
  library(dplyr)
  
  # Original usage of dplyr
  mtcars 
    filter(gear == 3,cyl == 8) 
    select(mpg, cyl, hp:vs)
  
  # Select user specified cols.
  # Note that you can have a vector of strings
  # or a single string separated by ',' or a mixture of both
  cols = c("mpg","cyl, hp:vs")
  mtcars 
    filter(gear == 3,cyl == 8) 
    s_select(cols)
  
  # Filter using a string
  col = "gear"
  mtcars 
    s_filter(paste0(var,"==3"), "cyl==8" ) 
    select(mpg, cyl, hp:vs)
    s_arrange("mpg")
  
  # group_by and summarise with strings
  mtcars 
    s_group_by("cyl") 
    s_summarise("mean(disp), max(disp)")

## End(Not run)

skranz/sktools documentation built on May 30, 2019, 3:03 a.m.