Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/yonicd/ripe

rerun {magrittr} pipelines
https://github.com/yonicd/ripe

magrittr magrittr-pipes r

Last synced: 2 months ago
JSON representation

rerun {magrittr} pipelines

Awesome Lists containing this project

README

        

---
output: github_document
always_allow_html: yes
---

[![CRAN status](https://www.r-pkg.org/badges/version/ripe)](https://CRAN.R-project.org/package=ripe)
[![R-win build status](https://github.com/yonicd/ripe/workflows/R-win/badge.svg)](https://github.com/yonicd/ripe)
[![R-mac build status](https://github.com/yonicd/ripe/workflows/R-mac/badge.svg)](https://github.com/yonicd/ripe)
[![R-linux build status](https://github.com/yonicd/ripe/workflows/R-linux/badge.svg)](https://github.com/yonicd/ripe)
[![Codecov test coverage](https://codecov.io/gh/yonicd/ripe/branch/master/graph/badge.svg)](https://codecov.io/gh/yonicd/ripe?branch=master)
[![Covrpage Summary](https://img.shields.io/badge/covrpage-Last_Build_2019_11_20-brightgreen.svg)](http://tinyurl.com/vzcsnsa)

```{r, echo = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "README-"
)

library(ripe)
```

# ripe

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()
```