knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>",
  fig.path = "man/figures/README-",
  out.width = "100%"
)

arpr

R-CMD-check

The goal of arpr is to provide convenience functions for programming with magrittr pipes. Conditional pipes, a string prefixer and a function to pipe the given object into a specific argument given by character name are currently supported. It is named after the dadaist Hans Arp, a friend of Rene Magritte.

Note that the {arpr} package was originally created by Jirka Lewandowski. The present repository is a fork to be able to continue development of this package, required for {gitlabr}.

Installation

You can install the released version of arpr from CRAN with:

install.packages("arpr")

And the development version from GitHub with:

# install.packages("devtools")
devtools::install_github("statnmap/arpr")

Examples

library(arpr)
"xyz" %>%
   prefix("abc")
x <- 1
x %>%
  iff(is.na, const(0))
x <- NA
x %>%
  iff(is.na, const(0))

x <- 1
x %>%
  iff(x <= 0, function(x) { x - 2 })
x <- -1
x %>%
  iff(x <= 0, function(x) { x - 2 })

x <- NA
x %>%
  iffn(is.na, exp)
x <- 10
x %>%
  iffn(is.na, exp)
5L %>%
  pipe_into("digits", format, 2.731234567)


statnmap/arpr documentation built on Dec. 23, 2021, 5:28 a.m.