brickset

R package to interface with the Brickset API for getting data about LEGO.

https://github.com/jbryer/brickset

Science Score: 26.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
  • Academic publication links
  • Academic email domains
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (18.0%) to scientific vocabulary

Keywords

lego rstats-package
Last synced: 10 months ago · JSON representation

Repository

R package to interface with the Brickset API for getting data about LEGO.

Basic Info
Statistics
  • Stars: 16
  • Watchers: 1
  • Forks: 0
  • Open Issues: 0
  • Releases: 2
Topics
lego rstats-package
Created over 5 years ago · Last pushed over 1 year ago
Metadata Files
Readme Changelog License Code of conduct

README.Rmd

---
output: github_document
md_extensions:
  self_contained: true
editor_options: 
  chunk_output_type: console
---

#  brickset: An R Package to Interface with the Brickset API for Getting Data About LEGO sets


[![R-CMD-check](https://github.com/jbryer/brickset/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/jbryer/brickset/actions/workflows/R-CMD-check.yaml)
`r badger::badge_devel("jbryer/brickset", "blue")`
`r badger::badge_cran_release("brickset")`
[![CRAN Status](https://badges.cranchecks.info/flavor/release/brickset.svg)](https://cran.r-project.org/web/checks/check_results_brickset.html)


**Author:** Jason Bryer, Ph.D. jason@bryer.org  
**Website:** https://jbryer.github.io/brickset/

```{r, echo=FALSE, results='hide', message=FALSE, warning=FALSE, error=FALSE}
knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>",
  fig.path = "man/figures/README-",
  out.width = "100%"
)

library(brickset)
library(ggplot2)
library(knitr)
data("legosets", package = 'brickset')
source('brickset_config.R')
```

This package provides functions to access data about [LEGO](https://www.lego.com/) sets from the [Brickset](https://brickset.com/) website. The package also contains a `data.frame` with all LEGO sets (n = `r prettyNum(nrow(legosets), big.mark = ',')`) from `r min(legosets$year)` through `r max(legosets$year)`. This data set was created using the `getSets` function and it is recommended that you use this data frame to reduce the number of API calls. See the [build.R](https://github.com/jbryer/PSAboot/blob/master/build.R) script for how the data frame was created. Information about the variables is included below.

## Installation

You can download from CRAN using:

```{r, eval=FALSE}
install.packages('brickset')
```

Or the latest development version using the `remotes` package:

```{r, eval=FALSE}
remotes::install_github('jbryer/brickset')
```

## Brickset API

To use the Brickset API, you must first create a [Brickset account](https://brickset.com/signup) and request an [API key](https://brickset.com/tools/webservices/requestkey). The full Brickset API documentation is available here: https://brickset.com/article/52664/api-version-3-documentation

Most of the functions require a Brickset username, password, and API key. You can pass these as parameters, or you can set these options:

```{r, eval=FALSE}
options(brickset_key = 'YOUR_API_KEY',
		brickset_username = 'YOUR_USERNAME',
		brickset_password = 'YOUR_PASSWORD')
```

The `checkKey` function will verify that your API key is valid:

```{r}
brickset::checkKey()
```

You can check your API usage with the `getKeyUsageStats` function.

```{r}
brickset::getKeyUsageStats()
```

The `getSets` function returns all LEGO sets from the given year.

```{r}
sets2021 <- brickset::getSets(2021)
head(sets2021, n = 3)
```

The `getReviews` function will return all reviews for a given set.

```{r}
reviews29830 <- brickset::getReviews(29830)
names(reviews29830)
```

The `getThemes` and `getSubthemes` returns information about LEGO themes.

```{r}
getThemes() |> head(n = 3)
getSubthemes('Toy Story')
getYears('Toy Story')
```

The `getInstructions` will return a table with the URLs to the building instructions.

```{r}
instructions <- getInstructions(setID = 29830)
instructions
```

## `legosets` Dataset

The `legosets` data frame contains all LEGO sets (n = `r prettyNum(nrow(legosets), big.mark = ',')`) from `r min(legosets$year)` through `r max(legosets$year)`.

```{r legosets_by_year, fig.height=4}
data("legosets", package = "brickset")
ggplot(legosets, aes(x = year)) + geom_bar() +
	ggtitle('Number of LEGO sets by year') +
	xlab('Year') + ylab('Number of LEGO Sets')
```

```{r pieces_by_price, fig.height=4, warning = FALSE}
ggplot(legosets, aes(x = pieces, y = US_retailPrice)) + 
	geom_point() +
	ggtitle('Cost of LEGO sets by number of pieces') +
	xlab('Number of LEGO pieces') + ylab('US Retail Price (dollars)')
```


The variables in the `legosets` data frame are:

```{r, echo=FALSE, results='asis'}
legosets_cols <- data.frame(
	row.names = names(legosets),
	Type = character(ncol(legosets)),
	Unique_Values = integer(ncol(legosets))
)

for(i in names(legosets)) {
	legosets_cols[i,'Type'] <- class(legosets[,i])
	legosets_cols[i,'Unique_Values'] <- length(unique(legosets[,i]))
}
knitr::kable(legosets_cols, format = 'markdown')
```

## Code of Conduct

Please note that the brickset project is released with a [Contributor Code of Conduct](https://jbryer.github.io/brickset/CODE_OF_CONDUCT.html). By contributing to this project, you agree to abide by its terms.

Owner

  • Name: Jason Bryer
  • Login: jbryer
  • Kind: user
  • Location: Albany, NY
  • Company: City University of New York

Assistant Professor and Associate Director, Data Science and Information Systems, School of Professional Studies, CUNY

GitHub Events

Total
  • Watch event: 2
  • Push event: 10
Last Year
  • Watch event: 2
  • Push event: 10

Issues and Pull Requests

Last synced: 10 months ago

All Time
  • Total issues: 1
  • Total pull requests: 0
  • Average time to close issues: 2 days
  • Average time to close pull requests: N/A
  • Total issue authors: 1
  • Total pull request authors: 0
  • Average comments per issue: 2.0
  • Average comments per pull request: 0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 0
  • Pull requests: 0
  • Average time to close issues: N/A
  • Average time to close pull requests: N/A
  • Issue authors: 0
  • Pull request authors: 0
  • Average comments per issue: 0
  • Average comments per pull request: 0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
  • spkaluzny (1)
Pull Request Authors
Top Labels
Issue Labels
Pull Request Labels

Packages

  • Total packages: 1
  • Total downloads:
    • cran 288 last-month
  • Total dependent packages: 0
  • Total dependent repositories: 0
  • Total versions: 3
  • Total maintainers: 1
cran.r-project.org: brickset

Interface with the Brickset API for Getting Data About LEGO Sets

  • Versions: 3
  • Dependent Packages: 0
  • Dependent Repositories: 0
  • Downloads: 288 Last month
Rankings
Stargazers count: 22.5%
Forks count: 28.8%
Dependent packages count: 29.8%
Dependent repos count: 35.5%
Average: 41.2%
Downloads: 89.6%
Maintainers (1)
Last synced: 11 months ago

Dependencies

.github/workflows/R-CMD-check.yaml actions
  • actions/checkout v3 composite
  • r-lib/actions/check-r-package v2 composite
  • r-lib/actions/setup-r v2 composite
  • r-lib/actions/setup-r-dependencies v2 composite
.github/workflows/pkgdown.yaml actions
  • JamesIves/github-pages-deploy-action v4.4.1 composite
  • actions/checkout v3 composite
  • r-lib/actions/setup-pandoc v2 composite
  • r-lib/actions/setup-r v2 composite
  • r-lib/actions/setup-r-dependencies v2 composite
DESCRIPTION cran
  • dplyr * imports
  • httr * imports
  • jsonlite * imports
  • piggyback * imports
  • DT * suggests
  • ggplot2 * suggests
  • knitr * suggests
  • shiny * suggests