[R] How to parse a really silly date with lubridate

Dr Eberhard W Lisse no@p@m @end|ng |rom ||@@e@NA
Wed Jul 13 23:48:48 CEST 2022


Bui,

thanks, this what Avi suggested in an email to me as well and works.

It's so easy if you know it :-)-O

el

On 2022-07-13 23:40 , Rui Barradas wrote:
> Hello,
> 
> Are you looking for mutate? In the example below I haven't included the 
> filter, since the tibble only has 2 rows. But the date column is coerced 
> to an actual datetime class in place, without the need for NewDate.
> 
> suppressPackageStartupMessages({
>    library(tibble)
>    library(dplyr)
> })
> 
> DDATA <- tibble(Date = c('9. Jul 2022 at 11:39', '10. Jul 2022 at 01:58'))
> 
> DDATA %>%
>    mutate(Date = lubridate::dmy_hm(Date))
> #> # A tibble: 2 × 1
> #>   Date
> #>   <dttm>
> #> 1 2022-07-09 11:39:00
> #> 2 2022-07-10 01:58:00
> 
> 
> Hope this helps,
> 
> Rui Barradas
[...]



More information about the R-help mailing list