Problem with Pipe

Hi everyone, I am a new learner of R. I was practicing and I wrote this

divvy_data_1 <- divvy_data %>%
select(started_at, ended_at, start_station_name, end_station_name, member_casual) %>%
separate(col = started_at, into = c("started_date", "started_time"), sep = " ") %>%
separate(col = ended_at, into = c("ended_date", "ended_time"), sep = " ") %>%
mutate(
started_time = as.POSIXct(started_time),
ended_time = as.POSIXct(ended_time),
duration_min = as.numeric(difftime(ended_time, started_time, units = "mins")),
duration = format(as.POSIXct(duration_min * 60, origin = "1970-01-01"), format = "%H:%M:%S")
) %>%
rename(customer_type = member_casual)

However, every time I run it I get this message
Error in divvy_data %>% select(started_at, ended_at, start_station_name, :
could not find function "%>%"
Could anyone explain it to me please Thank you

You need to do library(tidyverse) or library(magrittr) or switch to the newer, built-in pipe |>.

3 Likes

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.