Skip to content
Prev 305248 / 398506 Next

Maintaining specific order when using aggregate or change order on axis

Right after importing your data with read.csv, make a factor out of your
Depth column and give it levels in the desired order.  E.g.,
   SChla$Depth <- factor(SChla$Depth, levels=c("Surface", "Shallow", "Deep", "Fmax", "Below"))
(Capitalization is important, "Below" is not the same as "below".)

To check that things were imported as expect do
   table(SChla$Dept)
before and after the change.  Only the order of the table entries should change.

Bill Dunlap
Spotfire, TIBCO Software
wdunlap tibco.com