Set up packages and connect to RStudio Connect board

library(tidyverse)
## ── Attaching packages ────────────────────────────────── tidyverse 1.2.1 ──
## ✔ ggplot2 3.2.0     ✔ purrr   0.3.2
## ✔ tibble  2.1.3     ✔ dplyr   0.8.3
## ✔ tidyr   0.8.3     ✔ stringr 1.4.0
## ✔ readr   1.3.1     ✔ forcats 0.4.0
## ── Conflicts ───────────────────────────────────── tidyverse_conflicts() ──
## ✖ dplyr::filter() masks stats::filter()
## ✖ dplyr::lag()    masks stats::lag()
library(magrittr)
## 
## Attaching package: 'magrittr'
## The following object is masked from 'package:purrr':
## 
##     set_names
## The following object is masked from 'package:tidyr':
## 
##     extract
library(bikeHelpR)

pins::board_register_rsconnect(server = "https://colorado.rstudio.com/rsc",
                               key = Sys.getenv("RSTUDIOCONNECT_API_KEY"))

Get data from API

# Get list of feeds
feeds <- feeds_urls()

# Get station status Data and clean
dat <- feeds %>% 
  filter(name == "station_information") %>%
  pull("url") %>%
  get_data() %>%
  extract2("data") %>%
  select(station_id, name, lat, lon) %>%
  unique()

Pin

pins::pin(dat, 
          "bike_station_info", 
          "List of stations of Capitol Bikeshare", 
          "rsconnect")
## # A tibble: 579 x 4
##    station_id name                                           lat   lon
##    <chr>      <chr>                                        <dbl> <dbl>
##  1 1          Eads St & 15th St S                           38.9 -77.1
##  2 2          18th St & S Eads St                           38.9 -77.1
##  3 3          Crystal Dr & 20th St S                        38.9 -77.0
##  4 4          Crystal Dr & 15th St S                        38.9 -77.0
##  5 5          Aurora Hills Cmty Ctr / 18th St & S Hayes St  38.9 -77.1
##  6 6          Pentagon City Metro / 12th St & S Hayes St    38.9 -77.1
##  7 7          Army Navy Dr & S Joyce St                     38.9 -77.1
##  8 8          Crystal City Metro / 18th St & S Bell St      38.9 -77.1
##  9 10         Crystal Dr & 27th St S                        38.8 -77.1
## 10 11         S Glebe Rd & Potomac Ave                      38.8 -77.1
## # … with 569 more rows