I want Help i stuck in how to change Character into Posixct

all_trips <- bind_rows(q2_2019, q3_2019, q4_2019, q1_2020)
when I run code chunk I receive this error mentioned below
Error in bind_rows():
! Can't combine started_at and started_at <datetime>.
Run rlang::last_error() to see where the error occurred.
Then I see the structure of my data using the str() function so I see my data time column is not a Posixct.. so please how can I change chr into posixct

Here is an example using the lubridate package.

library(lubridate)
#> 
#> Attaching package: 'lubridate'
#> The following objects are masked from 'package:base':
#> 
#>     date, intersect, setdiff, union
DF <- data.frame(started_at=c("1/21/2020 20:06"))
str(DF)
#> 'data.frame':    1 obs. of  1 variable:
#>  $ started_at: chr "1/21/2020 20:06"
DF$started_at <- mdy_hm(DF$started_at)
str(DF)
#> 'data.frame':    1 obs. of  1 variable:
#>  $ started_at: POSIXct, format: "2020-01-21 20:06:00"

Created on 2022-09-14 with reprex v2.0.2

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.