How to find the day of a week from a data frame in R?


It can be done by using weekdays function.

Example

< df = data.frame(date=c("2020-07-01", "2020-08-10", "2020-11-15"))
< df$day <- weekdays(as.Date(df$date))
< df
     date      day
1 2020-07-01 Wednesday
2 2020-08-10 Monday
3 2020-11-15 Sunday

Updated on: 06-Jul-2020

157 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements