I have the following data.frame in R:
> daily
DoW Duration
1 Friday 14.0000000000000
2 Monday 21.0000000000000
3 Saturday 12.0000000000
Instead of a factor
, what you want is an Ordered.Factor
.
This line of R code converts your DoW
variable to an "Ordered Factor":
daily$DoW <- ordered(daily$DoW, levels=c("Monday", "Tuesday", "Wednesday", "Thursday",
"Friday", "Saturday", "Sunday"))
Now when you use table
, plot
or any other functions on Dow
it will be the order you specified above.