Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

A poor man's dependency free grammar of data manipulation

License

NotificationsYou must be signed in to change notification settings

nathaneastwood/poorman

Repository files navigation

{poorman}

CRAN statusDependenciesCRAN downloadsR-CMD-checkcodecov

I’d seen my father. He was a poor man, and I watched him do astonishingthings. - Sidney Poitier

Overview

{poorman} is a grammar of data manipulation, providing dependency freeversions of{dplyr} verbs thathelp you solve the most common data manipulation challenges:

  • select() picks variables based on their names.
  • mutate() adds new variables that are functions of existingvariables.
  • 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. Inaddition to replicating {dplyr} functionality, {poorman} implementsother functionality from the wider {tidyverse} such as select helpersand the pipe,%>%.

For more details on the functionality available within {poorman}, checkout the {poorman} series of blog postshere.

(back to top)

Installation

You can install:

  • the development version fromGitHub 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 usingDocker, you can run the latest image with:

docker run --rm -it nathaneastwood/poorman

(back to top)

Usage

library(poorman,warn.conflicts=FALSE)##   I'd seen my father. He was a poor man, and I watched him do astonishing things.#     - Sidney Poitiermtcars %>%  select(mpg,wt, starts_with("c")) %>%  mutate(kpl= (1.609*mpg)/3.785,wt_kg=wt*453.5924) %>%  filter(mpg>28)#                 mpg    wt cyl carb      kpl    wt_kg# Fiat 128       32.4 2.200   4    1 13.77321 997.9033# Honda Civic    30.4 1.615   4    2 12.92301 732.5517# Toyota Corolla 33.9 1.835   4    1 14.41086 832.3421# Lotus Europa   30.4 1.513   4    2 12.92301 686.2853mtcars %>%  group_by(am,cyl) %>%  summarise(mean_mpg= mean(mpg),sd_mpg= sd(mpg)) %>%  ungroup()#   am cyl mean_mpg    sd_mpg# 1  0   4 22.90000 1.4525839# 2  0   6 19.12500 1.6317169# 3  0   8 15.05000 2.7743959# 4  1   4 28.07500 4.4838599# 5  1   6 20.56667 0.7505553# 6  1   8 15.40000 0.5656854

(back to top)

Related Work

  • {dplyr}
  • {bplyr} - imports {magrittr} and{rlang}; it prepends functions withb_*(), e.g. b_select().
  • {tbltools} - imports{magrittr} and appends*_data() to each of its functions,e.g. select_data().

(back to top)

About

A poor man's dependency free grammar of data manipulation

Topics

Resources

License

Contributing

Stars

Watchers

Forks

Sponsor this project

 

Languages


[8]ページ先頭

©2009-2025 Movatter.jp