library(tidyverse)
library(broom)
library(ggformula)
library(patchwork)AE 02: Bike rentals in Washington, DC
Simple linear regression
Open RStudio and create a subfolder in your AE folder called “AE-02”
Go to the Canvas and locate the
AE-2assignment. That link should take you directly there.Upload the
ae-02.qmdanddcbikeshare.csvfiles into the folder you just created.
The .qmd and .html files form this assignment are due in Canvas no later than Tuesday, September 3 at 11:59pm.
Data
Our data set contains daily rentals from the Capital Bikeshare in Washington, DC in 2011 and 2012. It was obtained from the dcbikeshare data set in the dsbox R package.
We will focus on the following variables in the analysis:
count: total bike rentalstemp_orig: Temperature in degrees Celsiusseason: 1 - winter, 2 - spring, 3 - summer, 4 - fall
Click here for the full list of variables and definitions.
Note that you may need to adjust the file path below:
bikeshare <- read_csv("data/dcbikeshare.csv")Exercises
Exercise 1
Below are visualizations of the distributions of daily bike rentals and temperature as well as the relationship between these two variables.
p1 <- gf_histogram(~ count, data = bikeshare, binwidth = 250) |>
gf_labs(x = "Daily bike rentals")
p2 <- gf_histogram(~temp_orig, data = bikeshare) |>
gf_labs(x = "Temperature (Celsius)")
p3 <- gf_point(count ~ temp_orig, data = bikeshare) |>
gf_labs(x = "Temperature (Celsius)",
y = "Daily bike rentals")
(p1 | p2) / p3
[Add your answer here]
Exercise 2
# add code developed during livecoding hereExercise 3
# add code developed during livecoding hereExercise 4
[Add your answer here]
Exercise 5
# add code developed during livecoding hereExercise 6
# add code developed during livecoding hereExercise 7
[Add your answer here]
Exercise 8
[Add your answer here]
Exercise 9
[Add your answer here]
Exercise 10
[Add your answer here]
To submit the AE:
- Render the document to produce the HTML with all of your work from today’s class.
- The driver for your group should upload your .qmd and .html files to the Canvas assignment.