A poor man's dependency free grammar of data manipulation
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#",
fig.path = "man/figures/README-",
out.width = "100%"
)
options(poorman.summarise.inform = FALSE)
I'd seen my father. He was a poor man, and I watched him do astonishing things. - Sidney Poitier
{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.
You can install:
# install.packages("remotes")
remotes::install_github("nathaneastwood/poorman")
install.packages("poorman")
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
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()
b_*()
, e.g. b_select()
.*_data()
to each of its functions, e.g. select_data()
.