I am new to R
I've been struggling to understand how to get these columns for plotting. This columns are from different data. What I need to do is either use The wday() function in the lubridate package as it says that it be useful. Then I need to pivot the data to long format to get the Direction column. The Timeperiod column comes from the lockdown_dates data. Summarise the data to get appropriate averages.
Column Description
Weekday Day of week (Sunday through Saturday).
Hour Hour of day (0 through 23).
Direction To City or From City
Timeperiod Before times, Lockdown
Count Average (mean) number of cyclists per direction per hour for each time period and weekday.
I have these sample tables .
Date Timeperiod
1 2020-02-01 Before times
2 2020-02-02 Before times
3 2020-02-03 Before times
Date Hour From City To City
1 2020-02-01 0 0 1
2 2020-02-01 1 0 0
3 2020-02-01 2 0 0
I don't know how to start my code, I was thinking of grouping these to form the data but i know it wont work. I would appreciate if someone can give me an example how to do it.
but I tried this but it only gave me "Friday" not a column.
weekdays(as.Date("4/6/2018 20:14", "%m/%d/%Y"))