converting character to double

#formatting trip_duration from chr to dbl
cy_trips1 <- cy_trips %>%
trip_duration = as.numeric(tripduration)
hey guys, i am trying to convert trips_duration to double datatype
but i keep getting
Warning message:
Problem while computing trip_duration = as.numeric(tripduration).
i NAs introduced by coercion .

i read online someone said its because my csv file was loaded with comma separator "," so here i'm
pls how do i load my csv file and remove the comma "," separator

Something like this should work.

cy_trips1 <- cy_trips %>% mutate(tripduration = sub(",","", tripduration),

thank you it did work

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.