forked from WinVector/seplyr
-
Notifications
You must be signed in to change notification settings - Fork 0
/
README.Rmd
68 lines (43 loc) · 2.42 KB
/
README.Rmd
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
---
output: github_document
---
<!-- README.md is generated from README.Rmd. Please edit that file -->
```{r, echo = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = " # "
)
options(width =100)
```
The [`R`](https://www.r-project.org) package [`seplyr`](https://github.com/WinVector/seplyr) supplies improved *s*tandard *e*valuation interfaces for some common `dplyr` data plying tasks.
![](https://github.com/WinVector/seplyr/raw/master/tools/safety.png)
To get started we suggest visiting the [`seplyr` site](https://winvector.github.io/seplyr/), and checking out [some examples](https://winvector.github.io/seplyr/articles/seplyr.html).
One quick example:
```{r ex1c2}
# Assume this is set elsewhere,
# supplied by a user, function argument, or control file.
orderTerms <- c('cyl', 'desc(gear)')
# load packages
library("seplyr")
# where we are actually working (perhaps in a re-usable
# script or function)
datasets::mtcars %.>%
arrange_se(., orderTerms) %.>%
head(.)
```
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](https://CRAN.R-project.org/package=seplyr) with:
```{r, eval=FALSE}
install.packages('seplyr')
```
or from [`GitHub`](https://github.com/WinVector/seplyr):
```{r, eval=FALSE}
devtools::install_github('WinVector/seplyr')
```
Please see [`help("%.>%", package="wrapr")`](https://winvector.github.io/wrapr/reference/dot_arrow.html) for details on "dot pipe."
In addition to standard interface adapters `seplyr` supplies some non-trivial
statement transforms:
* [`partition_mutate_se()`](https://winvector.github.io/seplyr/reference/partition_mutate_se.html): [vignette](https://winvector.github.io/seplyr/articles/MutatePartitioner.html), and [article](http://winvector.github.io/FluidData/partition_mutate.html).
* [`if_else_device()`](https://winvector.github.io/seplyr/reference/if_else_device.html): [article](http://winvector.github.io/FluidData/partition_mutate_ex2.html).
## 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.