I need a vector containing the days of the week very often, but I always type it out:
days.of.week <- c(\"Monday\", \"Tuesday\", \"Wednesday\", \"Thursday\",
While the function-based answers are slick, Joshua's last comment is spot-on. If you've got a variable you use regularly, either create it in your .Rprofile
or load it from an .Rdata
file, using some line in .Rprofile
like load('daysofweek.rdata')
.
Note that changing the first day of the week is as simple as
neworder <- days.of.week[c(2:7,1)]