<! i have tried using different functions such to calculate duration from two different time variables "started_at" and "ended-at" from bike_share data set i keep getting not found.
i have installed and loaded
install.packages("readr")
install.packages("readr")
library(readr)
library(tibble)
the use
difftime() its not working
am a beginner in R, please kindly assist.
thank you.
Because you're reading from a csv, the start end end datetimes are not numerical. You need to convert the character vectors started_at and ended_at to something that can be used to perform calculations. To do that, we can use the number of seconds that has passed since January 1, 1970, formatted as something that is a bit more readable than that. Right now for example, that's 1723547908 seconds, but it's much easier to read as "2024-08-13 07:18:28 EDT". So, here's a very simple example.