STAT 412/612 Week 12: Homework
forcats and lubridate
统计学作业代写 Load in the data containing trip information from the Capital Bikeshare program. Also load in the station information.
Instructions
- Submityour R Markdown file and your PDF, knitted directly from R Markdown, on Only include the necessary code, not any extraneous code, to answer the questions.
- Learningoutcomes:
-Manipulate factors with forcats.
-Manipulate dates with lubridate.
Question 1: Capital Bikeshare Data 统计学作业代写
- Load in the data containing trip information from the Capital Bikeshare program. Also load in the station information. Rename variables that have spaces in the names
trip data
station data
Note: These data were originally from http://data.codefordc.org/group/transportation.
2.Parse the date-time information from the trip Recall the times are recorded in the America/New_York time zone, not the UTC time zone. Specify that in your parser.
3.Calculate the average number of trips for each weekday (Sunday, Monday, Tuesday . . . ) given the day has There are several days with no trips. 统计学作业代写
- Savethe resulting days of week and corresponding average number of trips as a data frame called sumdf and print it out.
- It should look likethis:
4.Reproduce this plot inR:
5.In a stunning show of contempt, the IEEE Computer Society decided to add a new weekday called “Fooday”with abbreviation “Foo”. Fooday was decided to be the first day of the week (ahead of Sunday).
On the first Fooday ever, people used Capital Bikeshare in record numbers, yielding 15567 trips. Add Fooday as the first level to the wday variable in sumdf and add its average number of trips (now 15567 since there has only been one Fooday so far). 统计学作业代写
Hint: Create a new data frame that contains the Fooday trips and use bind_rows().
Your final data frame should look like this:
6.Inanother stunning show of contempt, the IEEE Computer Society decided to change the abbreviations from three letters to two Change the levels of wday so that each day uses only two-letter abbreviations. Your final data frame should look like this:
## # A tibble: 8 x 2
## wday mean_num_trips
## <fct> <dbl>
## 1 Fo 15567
## 2 Su 5111.
## 3 Mo 6057.
## 4 Tu 6617.
## 5 We 6846.
## 6 Th 7309.
## 7 Fr 6358.
## 8 Sa 6027
7.In the stations data frame, it seems that installDate is populated by the number of milliseconds sinceJanuary 1, 1970, 00:00:00 (in the America/New_York time zone). Parse this into a date-time and make a histogram of the install It should look something like this: 统计学作业代写
更多代写:matlab代做 托福代考 英国CS作业代写价格 土木工程essay代写 数学论文代写 代写History Book Review历史书评