Newbie to R - I need assistance in completing a function in Rstudio

I am trying to create a new column using the mutate function . However, the error states there are no numerical values in the function. How can i correct this? ( I need to subtract the end time from the start time in order to create a ride length column) take a look at the screenshot below to see my code

The error says that the inputs are not numeric. If you look at the output of

summary(cyclistic_q1_cleaned)

I think you will see that your start time and end time columns are characters.
I suggest you rethink what you are doing here. Why are you trying to extract the time-of-day part of the started_at and ended_at columns? If those columns are date-time values, you can simply subtract them to get the duration of the ride. Also, if a ride should go past midnight, the time-of-day portion of the end time will be less than that of the start time. If the started_at and ended_at columns are also characters, you can convert them to date-time values with a function from the lubridate package or with as.POSIXct().

1 Like

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