Ecosyste.ms: Awesome

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

https://github.com/nathaneastwood/poorman

A poor man's dependency free grammar of data manipulation
https://github.com/nathaneastwood/poorman

base-r data-manipulation grammar r

Last synced: about 2 months ago
JSON representation

A poor man's dependency free grammar of data manipulation

Lists

README

        

---
output: github_document
---

```{r, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#",
fig.path = "man/figures/README-",
out.width = "100%"
)
options(poorman.summarise.inform = FALSE)
```

# {poorman}

[![CRAN status](https://www.r-pkg.org/badges/version/poorman)](https://cran.r-project.org/package=poorman)
[![Dependencies](https://tinyverse.netlify.com/badge/poorman)](https://cran.r-project.org/package=poorman)
![CRAN downloads](https://cranlogs.r-pkg.org/badges/poorman)
[![R-CMD-check](https://github.com/nathaneastwood/poorman/actions/workflows/check-standard.yaml/badge.svg)](https://github.com/nathaneastwood/poorman/actions/workflows/check-standard.yaml)
[![codecov](https://codecov.io/gh/nathaneastwood/poorman/branch/master/graph/badge.svg?token=YPQSSEEHZJ)](https://app.codecov.io/gh/nathaneastwood/poorman)


I'd seen my father. He was a poor man, and I watched him do astonishing things.
- Sidney Poitier

## Overview

{poorman} is a grammar of data manipulation, providing dependency free versions of [{dplyr}](https://github.com/tidyverse/dplyr) verbs that help you solve the most common data manipulation challenges:

* `select()` picks variables based on their names.
* `mutate()` adds new variables that are functions of existing variables.
* `filter()` picks cases based on their values.
* `summarise()` reduces multiple values down to a single summary.
* `arrange()` changes the ordering of the rows.

{poorman} attempts to replicate the {dplyr} API exactly such that your {dplyr} code will still run even if you use {poorman} in its place. In addition to replicating {dplyr} functionality, {poorman} implements other functionality from the wider {tidyverse} such as select helpers and the pipe, `%>%`.

For more details on the functionality available within {poorman}, check out the {poorman} series of blog posts [here](https://nathaneastwood.github.io/tags/poorman/).

(back to top)

## Installation

You can install:

* the development version from [GitHub](https://github.com/nathaneastwood/poorman) with

```{r installation, eval = FALSE}
# install.packages("remotes")
remotes::install_github("nathaneastwood/poorman")
```

* the latest release from CRAN with

```{r cran, eval = FALSE}
install.packages("poorman")
```

(back to top)

## Docker

If you'd like to try out the latest version of the package on CRAN using Docker, you can run the latest image with:

```{bash, eval = FALSE}
docker run --rm -it nathaneastwood/poorman
```

(back to top)

## Usage

```{r usage}
library(poorman, warn.conflicts = FALSE)

mtcars %>%
select(mpg, wt, starts_with("c")) %>%
mutate(kpl = (1.609 * mpg) / 3.785, wt_kg = wt * 453.5924) %>%
filter(mpg > 28)

mtcars %>%
group_by(am, cyl) %>%
summarise(mean_mpg = mean(mpg), sd_mpg = sd(mpg)) %>%
ungroup()
```

(back to top)

## Related Work

* [{dplyr}](https://github.com/tidyverse/dplyr)
* [{bplyr}](https://github.com/yonicd/bplyr) - imports {magrittr} and {rlang}; it prepends functions with `b_*()`, e.g. `b_select()`.
* [{tbltools}](https://github.com/mkearney/tbltools) - imports {magrittr} and appends `*_data()` to each of its functions, e.g. `select_data()`.

(back to top)