poorman

A poor man's dependency free grammar of data manipulation


output: github_document

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

{poorman}

CRAN status
Dependencies
CRAN downloads
R-CMD-check
codecov

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} 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.

(back to top)

Installation

You can install:

  • the development version from GitHub with
# install.packages("remotes")
remotes::install_github("nathaneastwood/poorman")
  • the latest release from CRAN with
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:

docker run --rm -it nathaneastwood/poorman

(back to top)

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}
  • {bplyr} - imports {magrittr} and {rlang}; it prepends functions with b_*(), e.g. b_select().
  • {tbltools} - imports {magrittr} and appends *_data() to each of its functions, e.g. select_data().

(back to top)