I have a date in R and it's formatted as follows:
2018-08-31 01:00:00
Is there any way in R to add another column with the day of the week associated with the date? My dataset is very large.
I have a date in R and it's formatted as follows:
2018-08-31 01:00:00
Is there any way in R to add another column with the day of the week associated with the date? My dataset is very large.
This will probably do the trick for you.
Experiment with different settings of the label
- and abbr
-arguments to get the derised results.
library(lubridate)
lubridate::wday( as.POSIXct( "2018-08-31 01:00:00",
format = "%Y-%m-%d %H:%M:%S "),
label = TRUE,
abbr = FALSE )