all_trips2 %>%
mutate(weekday = wday(started_at, label = TRUE)) %>%
group_by(member_casual, weekday) %>%
summarise(number_of_rides = n(),average_duration = mean(ride_length))
dput(head(all_trips2))
structure(list(ride_id = c("21742443", "21742444", "21742445",
"21742446", "21742447", "21742448"), started_at = c("1/1/19 12:04 AM",
"1/1/19 12:08 AM", "1/1/19 12:13 AM", "1/1/19 12:13 AM", "1/1/19 12:14 AM",
"1/1/19 12:15 AM"), ended_at = c("1/1/19 12:11 AM", "1/1/19 12:15 AM",
"1/1/19 12:27 AM", "1/1/19 12:43 AM", "1/1/19 12:20 AM", "1/1/19 12:19 AM"
), rideable_type = c("2167", "4386", "1524", "252", "1170", "2437"
), ride_length = c(390, 441, 829, 1783, 364, 216), start_station_id = c(199,
44, 15, 123, 173, 98), start_station_name = c("Wabash Ave & Grand Ave",
"State St & Randolph St", "Racine Ave & 18th St", "California Ave & Milwaukee Ave",
"Mies van der Rohe Way & Chicago Ave", "LaSalle St & Washington St"
), end_station_id = c(84, 624, 644, 176, 35, 49), end_station_name = c("Milwaukee Ave & Grand Ave",
"Dearborn St & Van Buren St (*)", "Western Ave & Fillmore St (*)",
"Clark St & Elm St", "Streeter Dr & Grand Ave", "Dearborn St & Monroe St"
), member_casual = c("member", "member", "member", "member",
"member", "member"), date = structure(c(-719144, -719144, -719144,
-719144, -719144, -719144), class = "Date"), month = c("01",
"01", "01", "01", "01", "01"), day = c("19", "19", "19", "19",
"19", "19"), year = c("0001", "0001", "0001", "0001", "0001",
"0001"), day_of_week = structure(c(6L, 6L, 6L, 6L, 6L, 6L), .Label = c("Sunday",
"Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"
), class = c("ordered", "factor"))), row.names = c(NA, -6L), class = c("tbl_df",
"tbl", "data.frame"))
I keep getting this code error and cannot figure out what I'm doing wrong. This is from a provided exercise script for the Google Data Analytics case study.