Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/wlandau/grapes
Turn R functions into binary operators.
https://github.com/wlandau/grapes
Last synced: 16 days ago
JSON representation
Turn R functions into binary operators.
- Host: GitHub
- URL: https://github.com/wlandau/grapes
- Owner: wlandau
- Created: 2017-04-01T00:32:26.000Z (over 7 years ago)
- Default Branch: main
- Last Pushed: 2020-10-27T16:34:55.000Z (about 4 years ago)
- Last Synced: 2024-08-06T03:05:14.565Z (3 months ago)
- Language: R
- Homepage:
- Size: 170 KB
- Stars: 10
- Watchers: 4
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Contributing: .github/CONTRIBUTING.md
Awesome Lists containing this project
README
[![Travis-CI Build Status](https://travis-ci.org/wlandau/grapes.svg?branch=master)](https://travis-ci.org/wlandau/grapes)
[![AppVeyor Build Status](https://ci.appveyor.com/api/projects/status/github/wlandau/grapes?branch=master&svg=true)](https://ci.appveyor.com/project/wlandau/grapes)
[![codecov.io](https://codecov.io/github/wlandau/grapes/coverage.svg?branch=master)](https://codecov.io/github/wlandau/grapes?branch=master)
[![CRAN_Status_Badge](http://www.r-pkg.org/badges/version/grapes)](http://cran.r-project.org/package=grapes)In some computing subcultures, the term "grapes" refers to the percent sign, which R uses to name binary operators such as `%*%`. Here, `grapes` is an R package that turns arbitrary functions into binary operators. As with the [magrittr pipe](https://CRAN.R-project.org/package=magrittr/vignettes/magrittr.html), this allows you to avoid cumbersome parentheses in your code.
```{r}
library(grapes)
grow(rbind, c, from = "base") # Use `from` to specify a package or environment to search.
bunch() # see the operators (grapes you have grown)
nrow(sleep) # 20
longer = sleep %rbind% sleep %rbind% sleep # No clumsy parentheses!
nrow(longer) # 60. Most of us would like to sleep longer.
1 %rbind% 2 %c% 3
```# Installation
To install the development version, get the [devtools](https://CRAN.R-project.org/package=devtools) package and run
```
devtools::install_github("wlandau/grapes", build = TRUE)
```If you specify a tag, you can install a GitHub release.
```r
devtools::install_github("wlandau/[email protected]", build = TRUE)
```# Tutorial
The [online package vignette](https://github.com/wlandau/grapes/blob/master/vignettes/grapes.Rmd) has a complete tutorial. You can load the compiled version from an R session.
```r
vignette("grapes")
```# Help and troubleshooting
Please read the [issue tracker](https://github.com/wlandau/grapes/issues) first, taking care to browse both open and closed issues. Afterwards, if you still feel the need, [submit a new issue](https://github.com/wlandau/grapes/issues/new) to log a bug report or feature request.