Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jennybc/repurrrsive
Recursive lists to use in teaching and examples, because there is no mtcars for lists.
https://github.com/jennybc/repurrrsive
data json package r xml
Last synced: 5 days ago
JSON representation
Recursive lists to use in teaching and examples, because there is no mtcars for lists.
- Host: GitHub
- URL: https://github.com/jennybc/repurrrsive
- Owner: jennybc
- Created: 2016-10-22T19:59:07.000Z (over 8 years ago)
- Default Branch: main
- Last Pushed: 2023-08-08T03:44:11.000Z (over 1 year ago)
- Last Synced: 2024-04-26T05:23:39.874Z (9 months ago)
- Topics: data, json, package, r, xml
- Language: R
- Homepage: https://jennybc.github.io/repurrrsive/
- Size: 2.24 MB
- Stars: 133
- Watchers: 7
- Forks: 22
- Open Issues: 5
-
Metadata Files:
- Readme: README.Rmd
- Code of conduct: .github/CODE_OF_CONDUCT.md
Awesome Lists containing this project
- jimsghstars - jennybc/repurrrsive - Recursive lists to use in teaching and examples, because there is no mtcars for lists. (R)
README
---
output: github_document
---[![CRAN status](https://www.r-pkg.org/badges/version/repurrrsive)](https://CRAN.R-project.org/package=repurrrsive)
[![R-CMD-check](https://github.com/jennybc/repurrrsive/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/jennybc/repurrrsive/actions/workflows/R-CMD-check.yaml)
[![Codecov test coverage](https://codecov.io/gh/jennybc/repurrrsive/branch/main/graph/badge.svg)](https://app.codecov.io/gh/jennybc/repurrrsive?branch=main)```{r, echo = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
error = TRUE,
fig.path = "README-"
)
```# repurrrsive
The repurrrsive package provides recursive lists that are handy when teaching or exampling functions such as `purrr::map()` and the [rectangling functions](https://tidyr.tidyverse.org/articles/rectangle.html) in the tidyr package.
The datasets are stored as R list, JSON, and XML to provide the full non-rectangular data experience.
Enjoy!This package also includes the main data frame from the [gapminder package](https://CRAN.R-project.org/package=gapminder) in 3 different forms: simple data frame (no list-columns), data frame nested by country, and split into a named list of data frames.
## Installation
You can install repurrrsive from CRAN like so:
```{r cran-installation, eval = FALSE}
install.packages("repurrrsive")
```or from GitHub with:
```{r gh-installation, eval = FALSE}
# install.packages("pak")
pak::pak("jennybc/repurrrsive")
```## Recursive list examples
repurrrsive contains several datasets that are recursive lists, both in the form of R objects and as JSON and/or XML files.
For example, `got_chars` is a list with information on the `r length(repurrrsive::got_chars)` point-of-view characters from the first five books in the Song of Ice and Fire series by George R. R. Martin.
Here's how to use `purrr::map_chr()` to extract the character's names:```{r}
library(repurrrsive)
library(purrr)map_chr(got_chars, "name")
```Each set of recursive lists has its own article that gives a sense of what sort of manipulations can be demonstrated with the dataset(s):
* Game of Thrones characters
* Data on entities in the Star Wars universe
* GitHub user and repo data
* Sharla Gelfand's music collection
* Color palettes from Wes Anderson moviesLearn more at .
## Nested and split data frames
The Gapminder data, from the [gapminder package](https://github.com/jennybc/gapminder), is also here in various forms to allow practice of different styles of grouped computation.
For example, the `gap_nested` dataset has one row per country, with a nested `data` column containing longitudinal data for life expectancy, population, and GDP per capita.
```{r}
gap_nested
```