I am trying to create a weekday field using the wday function. The sponsor of this project gave us the following code:
analyze ridership data by type and weekday
all_trips_v2 %>%
mutate(weekday = wday(started_at, label = TRUE)) %>% #creates weekday field using wday()
group_by(member_casual, weekday) %>% #groups by usertype and weekday
summarise(number_of_rides = n() #calculates the number of rides and average duration
,average_duration = mean(ride_length)) %>% # calculates the average duration
arrange(member_casual, weekday) # sorts
I keep getting an error stating that (could not find function "wday")
Can somebody please help by telling me what am I doing wrong?
Thanks in advance.
Jesus