R studio project
--- title: "Bike Sharing and Local Weather Investigation" author: "Your Name" date: "Due: dd/mm/yyyy" output: html_notebook --- ```{r Front Matter, include=FALSE} ### Note: `include=FALSE` causes R to run the code, but does not show this chunk in the R Notebook # always clean up R environment rm(list = ls()) # packages # inputs & source data ``` # Project tasks ## 1. Data Access You will work with data on bike sharing in Washington D.C. available here (<http://www.stat.berkeley.edu/users/nolan/data/bikeshare.txt>). **Read the data set into an object called `Bike` directly from the URL (don't download it).** The table below breifly describes each variable in the `Bike` data: | Variable | Description | |:---------|:---------------------------------------------------| | instant | record index | | dteday | date | | season | season {1 = spring; 2 = summer; 3 = fall; 4 = winter} | | yr | year {0 = 2011; 1 = 2012} | | mnth | month ( 1 to 12) | | hr | hour (0 to 23) | | holiday | whether day is holiday or not | | weekday | day of the week | | workingday | if day is neither weekend nor holiday | | weathersit | weather {1 = Clear or partly cloudy; 2 = Mist + clouds; 3 = Light Snow or Rain; 4 = Heavy Rain or Snow} | | temp | Normalized temperature in Celsius (divided by 41) | | atemp | Normalized feeling temperature in Celsius (divided by 50) | | hum | Normalized percent humidity (divided by 100) | | windspeed | Normalized wind speed (divided by 67) | | casual | count of casual users | | registered | count of registered users | | cnt | count of total rental bikes including casual and registered | ```{r} Bike <- read.csv("http://www.stat.berkeley.edu/users/nolan/data/bikeshare.txt") str(Bike) ``` ## 2. Data Preparation You'll need to clean up a few variables before going much further. In particular, - `dteday` should be a date - create `newDate` as a datetime variable that includes both `dteday` and `hr` information - `weekday` should show the name of the day (e.g., Sunday, Monday, ...) - `workingday` should be a factor with labels "Yes" and "No" - `holiday` should be a factor with labels "Yes" and "No" ```{r} Bike<Bike%>% rename ``` ## 3. Exploring the Distribution of Riders **3.1 Begin by comparing the distribution of the counts of casual and registered riders using a "quantile-quantile plot" (i.e. qq plot).** **3.2 What does the qq plot tell you about the similarities and differences between these two distributions?** **3.3 Next, overlay density curves for casual and registered users. Explain your insights comparing this plot to the qq plot.** **3.4 Make another plot that examines the distribution of the counts of riders. Explain your insights comparing this plot to the qq plot and overlaid densities.** ## 4. Exploring Ride Sharing and Time **4.1 Use `newDate` to make a line plot for the number of casual riders and overlay a line plot for the number of registered riders. Restrict the time interval to the month of June in 2011. Use color to distinguish between the 2 types of riders.** **4.2 The plot has several intersting features. How do the number of casual and registered riders compare for different times of day and days of the week?** **4.3 Make another plot that examines the relationship between time and rider counts. Explain what additional insights your plot provides.** *(Recall that there are several other variables in the plot that contain time-related information)* ## 5. Exploring Ride Sharing and Local (Washington DC) Weather **5.1 Create a new variable called `propCasual` that is the proportion of casual riders among total riders in an hour.** - Add this variable to the data frame bike. - **Make a scatter plot of `propCasual` and `temp`.** - Take appropriate steps to correct for overplotting & ink saturation; - also, color the points according to weather or the day of week, whichever you find more informative. **5.2 What interesting aspect about this relationship do you see in this plot?** **5.3 Make a different plot that examines the relationship between weather and rider counts. Explain what additional insights your plot provides.** *(Recall that there are several other variables in the plot that contain weather-related information.)* ## 6. Summary based on exploratory data analysis (EDA) Write out a short discussion (less than 1 page) that summarizes what you have learned from this analysis. You are also welcome to supplement with additional analyses beyond the information you have learned from the previous exercises. Just make sure that you briefly state the source of your information when citing work elsewhere in the document, e.g. "From the Figure in the solution to Problem 4.3, I found that..."