Analyzing ridership data by type and workday

Hi! I'm currently doing a case study to analyze how casual riders and annual members use bikes differently.

The following code will not run.

# 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

While I do have a preference towards Python. I am warming up to R. Any errors I come across in R, I would like to learn as to why this errors arise and not repeat them in the future. Any help would be appreciated.

Thanks for providing code , but you could take further steps to make it more convenient for other forum users to help you.

Share some representative data that will enable your code to run and show the problematic behaviour.

You might use tools such as the library datapasta, or the base function dput() to share a portion of data in code form, i.e. that can be copied from forum and pasted to R session.

Reprex Guide

Hi Nirgrahamuk! Thank you for reaching out and replying! It turns out that I simply forgot to call another library. In the code block I provided used the wday function. The wday() function is exclusive to the lubridate library. I installed it, but I didn't call it (is that how you say it). Anyway, thank you for reaching out. Hope you enjoyed the Memorial Day weekend.

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.