The 'seplyr' (standard evaluation plying) package supplies improved standard evaluation adapter methods for important common 'dplyr' data manipulation tasks. In addition the 'seplyr' package supplies several new "key operations bound together" methods. These include 'group_summarize()' (which combines grouping, arranging and calculation in an atomic unit), 'add_group_summaries()' (which joins grouped summaries into a 'data.frame' in a well documented manner), 'add_group_indices()' (which adds per-group identifiers to a 'data.frame' without depending on row-order), 'partition_mutate_qt()' (which optimizes mutate sequences), and 'if_else_device()' (which simulates per-row if-else blocks in expression sequences).
The R
package seplyr
supplies improved standard evaluation interfaces for some common dplyr
data plying tasks.
To get started we suggest visiting the seplyr
site, and checking out some examples.
One quick example:
# supplied by a user, function argument, or control file.orderTerms <- c('cyl', 'desc(gear)')# load packageslibrary("seplyr")# Loading required package: wrapr# where we are actually working (perhaps in a re-usable# script or function)datasets::mtcars %.>%arrange_se(., orderTerms) %.>%head(.)# mpg cyl disp hp drat wt qsec vs am gear carb# 1 26.0 4 120.3 91 4.43 2.140 16.70 0 1 5 2# 2 30.4 4 95.1 113 3.77 1.513 16.90 1 1 5 2# 3 22.8 4 108.0 93 3.85 2.320 18.61 1 1 4 1# 4 24.4 4 146.7 62 3.69 3.190 20.00 1 0 4 2# 5 22.8 4 140.8 95 3.92 3.150 22.90 1 0 4 2# 6 32.4 4 78.7 66 4.08 2.200 19.47 1 1 4 1
The concept is: in writing re-usable code or scripts you pretend you do not know the actual column names you will be asked to work with (that these will be supplied as values later at analysis time). This forces you to write scripts that can be used even if data changes, and are re-usable on new data you did not know about when writing the script.
To install this package please either install from CRAN with:
install.packages('seplyr')
Please see help("%.>%", package="wrapr")
for details on "dot pipe."
In addition to standard interface adapters seplyr
supplies some non-trivial statement transforms:
Note: seplyr
is meant only for "tame names", that is: variables and column names that are also valid simple (without quotes) R
variables names.