knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>",
  fig.path = "man/figures/README-",
  out.width = "100%"
)

brewr

Travis build status AppVeyor build status Codecov test coverage

The goal of brewr is to access Homebrews JSON API in R.

Installation

You can install brewr from github using devtools with:

devtools::install_github("tylurp/brewr")

Example

Use the brewr() function to access all API endpoints. The endpoints can be found here.

The first argument of brewr() is the endpoint. Note that the leading slash must be included as well.

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



tyluRp/brewr documentation built on May 15, 2019, 9:56 p.m.