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

bluebike R package

Lifecycle: experimental CRAN status R-CMD-check

Summary

Our package includes data from the Boston Blue Bike trip history data acquired from the Blue Bikes System Data. The users can import all monthly trip history data from 2020 to 2022 into a cleaned data set that can easily be used for data analysis. \

The package also includes a sample data set that includes 1000 sampled trip history from Feb. 2022, and a full data set that contains information about all available stations. Functions inside the package:\

The package would be a useful tool for the Blue Bike operations to analyze the trip data and help improve the shared bike service based on user data. It is also an easy-to-use tool for data analysis and visualization for anyone interested in the Blue Bike trip data.

Installation

Get the latest released version from CRAN:

install.packages("bluebike")

You can also install the development version of bluebike from GitHub with:

# install.packages("devtools")
devtools::install_github("zyang2k/bluebike")

You can load this package by

library(bluebike)

Data Sets Included

Basic Usage

library(bluebike)
library(dplyr)

Retrieve data online

import_month_data enables users to retrieve monthly data from Bluebike System Data website.

jan2015 <- import_month_data(2015, 1)

Data Wrangling

stations <- trip_history_sample %>% 
  group_by(start_station_name) %>% 
  summarize(trips_from = n())
head(stations)
jan_distance <- jan2015 %>% 
  sample_n(1000) %>% 
  trip_distance()
mean_jan_distance <- mean(jan_distance$distance)

mean_jan_distance
top_5_station <- station_distance(-71.13, 42.36) %>%
  head(5)

top_5_station

Data Visualization via Leaflet

a visualization demo

library(leaflet)

BostonMap <- leaflet(data = station_data) %>% 
  addTiles() %>% 
  addCircleMarkers(lng = station_data$longitude, 
                   lat = station_data$latitude, 
                   radius = 0.1, 
                   color = "blue")

BostonMap

closest stations demo

station_500 <- station_radius(-71.13, 42.36, r = 500)

station_500

Contributors



zyang2k/bluebike documentation built on May 7, 2022, 2:33 p.m.