{"id":13445133,"url":"https://github.com/tidyverse/purrr","last_synced_at":"2025-05-10T02:49:54.190Z","repository":{"id":23928794,"uuid":"27309729","full_name":"tidyverse/purrr","owner":"tidyverse","description":"A functional programming toolkit for R","archived":false,"fork":false,"pushed_at":"2025-02-07T15:12:27.000Z","size":10329,"stargazers_count":1312,"open_issues_count":36,"forks_count":279,"subscribers_count":63,"default_branch":"main","last_synced_at":"2025-05-03T03:08:30.607Z","etag":null,"topics":["functional-programming","r"],"latest_commit_sha":null,"homepage":"https://purrr.tidyverse.org/","language":"R","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":"hussien89aa/DataStructureAndAlgorithms","license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tidyverse.png","metadata":{"files":{"readme":"README.Rmd","changelog":"NEWS.md","contributing":".github/CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":".github/CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":null,"support":".github/SUPPORT.md","governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2014-11-29T17:33:40.000Z","updated_at":"2025-04-28T19:24:14.000Z","dependencies_parsed_at":"2023-02-14T19:31:14.397Z","dependency_job_id":"d138a3de-c0d0-4999-9cb4-3da62241b9b7","html_url":"https://github.com/tidyverse/purrr","commit_stats":{"total_commits":1171,"total_committers":100,"mean_commits":11.71,"dds":0.5636208368915456,"last_synced_commit":"870696c7d9f3208298ea84a36d813ffd28e59e49"},"previous_names":["hadley/purrr"],"tags_count":18,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tidyverse%2Fpurrr","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tidyverse%2Fpurrr/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tidyverse%2Fpurrr/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tidyverse%2Fpurrr/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tidyverse","download_url":"https://codeload.github.com/tidyverse/purrr/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252963621,"owners_count":21832538,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["functional-programming","r"],"created_at":"2024-07-31T05:00:23.728Z","updated_at":"2025-05-07T22:26:20.028Z","avatar_url":"https://github.com/tidyverse.png","language":"R","funding_links":[],"categories":["2017","R"],"sub_categories":["Book/monograph Lists and Reviews"],"readme":"---\noutput: github_document\n---\n\n\u003c!-- README.md is generated from README.Rmd. Please edit that file --\u003e\n\n```{r, echo = FALSE}\nknitr::opts_chunk$set(\n  collapse = TRUE,\n  comment = \"#\u003e\",\n  fig.path = \"README-\"\n)\n```\n\n# purrr \u003cimg src=\"man/figures/logo.png\" align=\"right\" /\u003e\n\n\u003c!-- badges: start --\u003e\n[![CRAN_Status_Badge](https://www.r-pkg.org/badges/version/purrr)](https://cran.r-project.org/package=purrr)\n[![Codecov test coverage](https://codecov.io/gh/tidyverse/purrr/branch/master/graph/badge.svg)](https://app.codecov.io/gh/tidyverse/purrr?branch=master)\n[![R-CMD-check](https://github.com/tidyverse/purrr/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/tidyverse/purrr/actions/workflows/R-CMD-check.yaml)\n\u003c!-- badges: end --\u003e\n\n## Overview\n\npurrr enhances R's functional programming (FP) toolkit by providing a complete and consistent set of tools for working with functions and vectors. If you've never heard of FP before, the best place to start is the family of `map()` functions which allow you to replace many for loops with code that is both more succinct and easier to read. The best place to learn about the `map()` functions is the [iteration chapter](https://r4ds.hadley.nz/iteration) in R for Data Science.\n\n## Installation\n\n```{r, eval = FALSE}\n# The easiest way to get purrr is to install the whole tidyverse:\ninstall.packages(\"tidyverse\")\n\n# Alternatively, install just purrr:\ninstall.packages(\"purrr\")\n\n# Or the the development version from GitHub:\n# install.packages(\"pak\")\npak::pak(\"tidyverse/purrr\")\n```\n\n## Cheatsheet\n\n\u003ca href=\"https://github.com/rstudio/cheatsheets/blob/master/purrr.pdf\"\u003e\u003cimg src=\"https://raw.githubusercontent.com/rstudio/cheatsheets/master/pngs/thumbnails/purrr-cheatsheet-thumbs.png\" width=\"630\" height=\"252\"/\u003e\u003c/a\u003e  \n\n## Usage\n\nThe following example uses purrr to solve a fairly realistic problem: split a data frame into pieces, fit a model to each piece, compute the summary, then extract the R^2^.\n\n```{r, eval = getRversion() \u003e= \"4.1\"}\nlibrary(purrr)\n\nmtcars |\u003e \n  split(mtcars$cyl) |\u003e  # from base R\n  map(\\(df) lm(mpg ~ wt, data = df)) |\u003e \n  map(summary) |\u003e\n  map_dbl(\"r.squared\")\n```\n\nThis example illustrates some of the advantages of purrr functions over the equivalents in base R:\n\n* The first argument is always the data, so purrr works naturally with the pipe.\n\n* All purrr functions are type-stable. They always return the advertised output\n  type (`map()` returns lists; `map_dbl()` returns double vectors), or they \n  throw an error.\n  \n* All `map()` functions accept functions (named, anonymous, and lambda), \n  character vector (used to extract components by name), or numeric vectors \n  (used to extract by position).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftidyverse%2Fpurrr","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftidyverse%2Fpurrr","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftidyverse%2Fpurrr/lists"}