Skip to content
Prev 333901 / 398506 Next

why change days of the week from a factor to an ordered factor?

Bert,
the issue is the sort order of the levels.  Time series graphs in the
alphabetical sort
order will be uninterpretable.  I show the three sets of contrasts for
factors, factors
with specified levels, and ordered factors.

week <- c("Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday")
class(week)

week.f <- factor(week)
levels(week.f)

week.l <- factor(week, levels=week)
levels(week.l)

week.o <- ordered(week, levels=week)
levels(week.o)

contrasts(week.f)

contrasts(week.l)

contrasts(week.o)

Rich
On Mon, Dec 2, 2013 at 10:35 AM, Bert Gunter <gunter.berton at gene.com> wrote: