Hello,
I'm relatively new to R Studio and I have not worked with time series often so this is probably a simple question. I am struggling to convert values such as the one below into a date value. Currently it is a factor.
4-Aug-89
I've tried as.Date() but it did not work for me and a couple lubridate functions. Any suggestions?
Thank you in advance!
lubridate::dmy('4-Aug-89') #> [1] "1989-08-04"
library(tidyverse) df <- tibble(date = factor(c("4-Aug-89", "3-Aug-89", "2-Aug-89")), record = 1:3) df %>% mutate(date = lubridate::dmy(date)) #> # A tibble: 3 x 2 #> date record #> <date> <int> #> 1 1989-08-04 1 #> 2 1989-08-03 2 #> 3 1989-08-02 3
Thank you so much for your help!
This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.