[R] Plotting ordered nominal data

S Ellison S.Ellison at lgc.co.uk
Fri Aug 1 18:20:10 CEST 2008


Sandy,

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,
try

length(c(1,2,NULL,3))

#versus
length(c(1,2,NA,3))


Steve E

>>> Sandy Small <sandy.small at nhs.net> 01/08/2008 16:21:29 >>>
Hi
I'm sure this question has been asked before but I can't find it in the

archives.
> 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:8}}



More information about the R-help mailing list