[R] Plotting ordered nominal data

Sandy Small sandy.small at nhs.net
Mon Aug 4 13:26:16 CEST 2008

   Many thanks
   I was sure it was simple. That was exactly what I wanted.
   I should have clarified that I was looking for a box-plot.
   Thanks to all who responed.
   S Ellison wrote:


You can re-order a factor with

df$Eyeball<-factor(df$Eyeball, levels=c("Normal", "Mild", "Moderate",
"Severe"), ordered=T)

(assuming df is your data frame and that you want an _ordered_ factor;
the latter is not essential to your plots)

Incidentally, "NULL" isn't a particularly friendly item to find in a
data frame. NULL often implies "I'm not here at all" while NA says "I
exist but I'm a missing value". For an example of when it might matter,



Steve E


Sandy Small [1]<sandy.small at nhs.net> 01/08/2008 16:21:29 >>>

I'm sure this question has been asked before but I can't find it in the


I want to plot them in the order "Normal", "Mild",

"Moderate", "Severe" so that the trend (or not) is obvious.

This email and any attachments are confidential. Any use...{{dropped:29}}


   1. mailto:sandy.small at nhs.net

More information about the R-help mailing list