Capital Bikeshare Data
library(readr)
bike.data <- read_csv('http://www.math.montana.edu/ahoegh/teaching/stat408/datasets/Bike.csv')
## Rows: 10886 Columns: 12
## ── Column specification ────────────────────────────────────────────────────────
## Delimiter: ","
## dbl (11): season, holiday, workingday, weather, temp, atemp, humidity, wind...
## dttm (1): datetime
##
## ℹ Use `spec()` to retrieve the full column specification for this data.
## ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
Capital Bikeshare Data
##
## Attaching package: 'lubridate'
## The following objects are masked from 'package:base':
##
## date, intersect, setdiff, union
library(dplyr)
bike.data <- bike.data %>% mutate(year = as.factor(year(datetime)), month = as.factor(month(datetime)))
monthly.counts <- bike.data %>% group_by(month) %>% summarize(num_bikes = sum(count)) %>% arrange(month)
monthly.counts
## # A tibble: 12 × 2
## month num_bikes
## <fct> <dbl>
## 1 1 79884
## 2 2 99113
## 3 3 133501
## 4 4 167402
## 5 5 200147
## 6 6 220733
## 7 7 214617
## 8 8 213516
## 9 9 212529
## 10 10 207434
## 11 11 176440
## 12 12 160160