Skip to content
Prev 334311 / 398506 Next

bargraph.CI

Furthermore, if you have a factor z with the levels in an undesirable order
or missing some levels you can call
  z <- factor(z, levels=betterOrderedLevels)
to get them in the order you want.  E.g.,

  > z <- factor(c("High", "Low", "High"))
  > table(z) # levels are in alphabetical order
  z
  High  Low 
     2    1 
  > # put them in semantically increasing order and add Medium
  > z <- factor(z, levels=c("Low", "Medium", "High"))
  > table(z)
  z
     Low Medium   High 
       1      0      2 
You can also rename them by adding the labels argument:
  > z2 <- factor(z, levels=c("Low", "Medium", "High"), labels=c("L","M","H"))
  > table(z2)
  z2
  L M H 
  1 0 2

Bill Dunlap
Spotfire, TIBCO Software
wdunlap tibco.com