Was it helpful?

Question

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

R ProgrammingServer Side ProgrammingProgramming

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
raja
Published on 06-Jul-2020 18:13:21
Advertisements
Was it helpful?
Not affiliated with Tutorialspoint
scroll top