-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathREADME.Rmd
113 lines (75 loc) · 2.36 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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
---
output: github_document
always_allow_html: yes
---
<!-- README.md is generated from README.Rmd. Please edit that file -->
<!-- badges: start -->
[](https://CRAN.R-project.org/package=ripe)
[](https://github.com/yonicd/ripe)
[](https://github.com/yonicd/ripe)
[](https://github.com/yonicd/ripe)
[](https://codecov.io/gh/yonicd/ripe?branch=master)
[](http://tinyurl.com/vzcsnsa)
<!-- badges: end -->
```{r, echo = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "README-"
)
library(ripe)
```
# ripe <img src="https://github.com/yonicd/ripe/raw/master/input/logo.png" align="right" class="logo"/>
The goal of ripe is to create a more flexible way to rerun {magrittr} pipelines.
## Installation
```{r,eval=FALSE}
remotes::install_github('yonicd/ripe')
```
## Goal
We want to rerun the following pipeline that contains stochastic elements in a shorter and more flexible way
```{r}
f <- function(){
stats::runif(20)%>%
sample(10)%>%
utils::head(5)
}
set.seed(123)
replicate(n=3,f(),simplify = FALSE)
```
## Can't I just add replicate to the end of it?
```{r}
set.seed(123)
stats::runif(20)%>%
sample(10)%>%
utils::head(5)%>%
replicate(n = 3,simplify = FALSE)
```
That didn't do what we wanted...
## This is better!
```{r}
set.seed(123)
stats::runif(20)%>%
sample(10)%>%
utils::head(5)%>%
ripe(replicate,n=3,simplify=FALSE)
```
## Manipulate Pipeline Replicates
We can now manipulate the pipeline or move `ripe` around into different subsets of the function sequence, creating iterative replication workflows.
```{r}
set.seed(123)
stats::runif(20)%>%
#sample(10)%>%
utils::head(5)%>%
ripe(replicate,n=3,simplify=FALSE)
```
## Convert Pipelines to Lazy Functions
You can also quickly convert the pipelines to a lazyeval function
```{r}
f <- stats::runif(20)%>%
sample(10)%>%
utils::head(5)%>%
lazy()
set.seed(123)
f()
f()
```