knitr::opts_chunk$set( collapse = TRUE, comment = "#>", fig.path = "man/figures/README-", out.width = "100%" )
The goal of brewr is to access Homebrews JSON API in R.
You can install brewr from github using devtools
with:
devtools::install_github("tylurp/brewr")
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)
See the shiny demo app here: https://github.com/tyluRp/brewr-shiny
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.