Learn R Programming

The R package seplyr supplies improved standard evaluation interfaces for some common dplyr data plying tasks.

This project is used in production to avoid exposing all of the details of rlang at the user level, and a demonstration of what can be done through value-oriented programming. Alternately one could use another value-oriented data manipulation system ‘rquery’/‘rqdatatable’.

To get started we suggest visiting the seplyr site, and checking out some examples.

One quick example:

# Assume this is set elsewhere,
# supplied by a user, function argument, or control file.
orderTerms <- c('cyl', 'desc(gear)')

# load packages
library("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
 #  Porsche 914-2 26.0   4 120.3  91 4.43 2.140 16.70  0  1    5    2
 #  Lotus Europa  30.4   4  95.1 113 3.77 1.513 16.90  1  1    5    2
 #  Datsun 710    22.8   4 108.0  93 3.85 2.320 18.61  1  1    4    1
 #  Merc 240D     24.4   4 146.7  62 3.69 3.190 20.00  1  0    4    2
 #  Merc 230      22.8   4 140.8  95 3.92 3.150 22.90  1  0    4    2
 #  Fiat 128      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

Note: seplyr is meant only for “tame names”, that is: variables and column names that are also valid simple (without quotes) R variables names.

Copy Link

Version

Install

install.packages('seplyr')

Monthly Downloads

46

Version

1.0.4

License

GPL-2 | GPL-3

Issues

Pull Requests

Stars

Forks

Maintainer

John Mount

Last Published

September 2nd, 2021

Functions in seplyr (1.0.4)

add_rank_indices

Arrange a data frame and rank indexes.
add_tally_se

tally/count standard interface.
count_se

tally/count standard interface.
factor_mutate

Re-write a dplyr::mutate() into safe blocks.
quote_mutate

Capture the expressions of a mutate-style command.
partition_mutate_se

Partition a sequence of mutate commands into longest ordered no create/use blocks.
distinct_se

Standard interface for distinct.
group_transmute

group_by and transmute as an atomic action.
rename_se

rename standard interface.
deselect

deselect standard interface.
tally_se

tally/count standard interface.
group_summarize

group_by and summarize as an atomic action.
reexports

Objects exported from other packages
filter_nse

Filter non-standard interface.
transmute_nse

transmute non-standard evaluation interface.
seplyr

seplyr: Standard Evaluation Improved Interfaces for Common Data Manipulatio Tasks
spread_se

Collect values from blocks of rows into columns.
gather_se

Distribute columns into blocks of rows.
group_mutate

group_by and mutate as an atomic action.
group_indices_se

group_indices standard interface.
if_else_device

Simulate a per-row block-if(){}else{}.
group_by_se

group_by standard interface.
mutate_seb

Run a sequence of quoted mutate blocks.
summarize_se

summarize standard interface.
mutate_se

mutate standard evaluation interface.
summarize_nse

summarize non-standard evaluation interface.
filter_se

filter standard interface.
novelName

Generate a name with a prefix disjoint from a set of names
mutate_nse

mutate non-standard evaluation interface.
select_nse

Select columns non-standard (code capturing) interface.
partition_mutate_qt

Partition a sequence of mutate commands into longest ordered no create/use blocks.
transmute_se

transmute standard interface.
select_se

Select columns standard interface.
add_group_sub_indices

Group a data frame and add in-group indices as a column.
add_count_se

tally/count standard interface.
add_group_indices

Group a data frame and add per-group indices as a column.
add_group_summaries

Simulate the group_by/mutate pattern with an explicit summarize and join.
arrange_se

Arrange standard interface.
complete_se

complete by standard interface