If you use dat %>% mutate( date = lubridate::dmy(date) ) Your column will be understood as a datetime object. If you wanted to bring it back to a String, but just say "Feb 2001", I'd do this: library(lubridate) dat %>% mutate( date = dmy(date), date_string = paste(month(date), year(date) )
As in, you'd like to make a variable marking the semester as "Fall", "Spring" or "None"? I'd do this: dat %>% mutate( semester = case_when( month(date) < 5 ~ "Spring", month(date) > 8 ~ "Fall" , TRUE ~ "Summer" ) )
Thanks a lot! From UTC -3 :D
Thank You for this beautiful Session.
Great video, thank you for making this.
From Hadley's book. (In case you were wondering, “POSIXct” stands for “Portable Operating System Interface”, calendar time)
Rolls right off the tongue! 🤣
Very informative video
Hey Kelly
I have the date column => 19/02/2001, and it is a character class. How can I convert it to Feb 2001?
Thank you
If you use
dat %>%
mutate(
date = lubridate::dmy(date)
)
Your column will be understood as a datetime object. If you wanted to bring it back to a String, but just say "Feb 2001", I'd do this:
library(lubridate)
dat %>%
mutate(
date = dmy(date),
date_string = paste(month(date), year(date)
)
@@SuperKrazy2000 Thank you!
Thank u for this. How to get previous working day date? Week starting on sunday and end on thurs day from 1 sep 2020 todate
Go back in time in Dr Who's TARDIS of course!
Many thanks for thi vids ! But I need help, how can I generate semester variable using an other date variable ?
As in, you'd like to make a variable marking the semester as "Fall", "Spring" or "None"?
I'd do this:
dat %>%
mutate(
semester = case_when(
month(date) < 5 ~ "Spring",
month(date) > 8 ~ "Fall" ,
TRUE ~ "Summer"
)
)