Modified version of dplyr's filter that uses string arguments
1 |
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)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.