Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/tylerlittlefield/brewr
:beer: R Interface to Homebrews JSON API
https://github.com/tylerlittlefield/brewr
homebrew r rstats
Last synced: 5 days ago
JSON representation
:beer: R Interface to Homebrews JSON API
- Host: GitHub
- URL: https://github.com/tylerlittlefield/brewr
- Owner: tylerlittlefield
- License: other
- Created: 2018-11-04T20:02:24.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2019-02-03T02:07:08.000Z (almost 6 years ago)
- Last Synced: 2023-07-20T12:01:30.452Z (over 1 year ago)
- Topics: homebrew, r, rstats
- Language: R
- Homepage: https://brewr.netlify.com/
- Size: 678 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.Rmd
- License: LICENSE
Awesome Lists containing this project
README
---
output: github_document
---```{r setup, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "man/figures/README-",
out.width = "100%"
)
```
# brewr
[![Travis build status](https://travis-ci.org/tyluRp/brewr.svg?branch=master)](https://travis-ci.org/tyluRp/brewr)
[![AppVeyor build status](https://ci.appveyor.com/api/projects/status/github/tyluRp/brewr?branch=master&svg=true)](https://ci.appveyor.com/project/tyluRp/brewr)
[![Codecov test coverage](https://codecov.io/gh/tyluRp/brewr/branch/master/graph/badge.svg)](https://codecov.io/gh/tyluRp/brewr?branch=master)The goal of brewr is to access [Homebrews JSON API](https://formulae.brew.sh/docs/api/) in R.
## Installation
You can install brewr from github using [`devtools`](https://github.com/r-lib/devtools) with:
``` r
devtools::install_github("tylurp/brewr")
```## Example
Use the `brewr()` function to access all API endpoints. The endpoints can be found [here](https://formulae.brew.sh/analytics/).
The first argument of `brewr()` is the endpoint. Note that the leading slash must be included as well.
```{r example, message=FALSE}
library(brewr)
library(dplyr)
library(jsonlite)# Pull metrics on macOS versions
os_versions <- brewr("/analytics/os-version/30d")# Default output is JSON
class(os_versions)# Convert JSON to an R object with jsonlite
os_versions %>%
fromJSON() %>%
.$items# Pull install metrics from the last 30 days
brewr("/analytics/install/30d") %>%
fromJSON() %>%
.$items %>%
head(10)# Pull cask installs from the last 30d
brewr("/analytics/cask-install/30d") %>%
fromJSON() %>%
.$items %>%
head(10)
```## Shiny demo
See the shiny demo app here: https://github.com/tyluRp/brewr-shiny