I have a data frame like this:
date count wd
2012-10-01 0 Monday
2012-10-02 5 Tuesday
2012-10-06 10 Saturday
2012-10-07 15 Sunday
I use
dat <- mutate(dat,wd = weekdays(as.Date(dat$date)))
to add a new array "wd" , however, I'd like to add a new factor array to show if this day is a weekday or weekend, something like:
date count wd
2012-10-01 0 weekday
2012-10-02 5 weekday
2012-10-06 10 weekend
2012-10-07 15 weekend
Is any simple way to do that? Thanks