I Can't change the column data type

I have column of duration in seconds but i want to convert it to minutes

trips_2019 <- read.csv("~/Cyclistic/2019/Divvy_Trips_2019_Q1.csv")
trips_2019 <- trips_2019 %>%
    distinct() %>%
trips_2019_new <- trips_2019 %>%
  cols_only(tripduration=col_integer()) %>%
  mutate(tripduration_M =tripduration/60 )

but i get this error "Error: Some col_types are not S3 collector objects: 1"

If is.numeric(trips_2019$tripduration) evaluates to TRUE, just

trips_2019$tripduration <- trips_2019$tripduration*60

thanks for the respond

but it give me False on is.numeric(trips_2019$tripduration)
how can i convert it to numeric data type

If is.character(trips_2019$tripduration) evaluates to TRUE, then trips_2019$tripduration = as.numeric(trips_2019$tripduration). If not, post the output of str(trips_2019)

I'm so thankful for your support

1 Like

This topic was automatically closed 7 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.