[R] Plotting ordered nominal data
John Kane
jrkrideau at yahoo.ca
Fri Aug 1 19:03:49 CEST 2008
I'm not really clear on what you want here. Are you talking about plotting multiple data points for each value ? In that case something like boxplot might be what you want. Otherwise if you just wish to plot a data point for each occurance of Normal etc then this will work but I'm not sure how appropriate it is as a way to look at the data.
If the graph looks a bit squashed, just stretch it.
x <- '"Measured" "Eyeball"
46.5 Normal
43.5 Mild
56.2 Normal
41.1 Mild
37.8 Moderate
12.6 Severe
17.3 Moderate
39.1 Normal
26.7 Mild
NA Normal
27.9 NA
68.1 Normal'
xx <- read.table(textConnection(x), header=TRUE, as.is=TRUE); xx
df1 <- data.frame(Eyeball= c("Normal", "Mild", "Moderate", "Severe"),
nums= c(1:4))
df2 <- merge(xx, df1, by="Eyeball", all=TRUE)
plot(df2[,2], xaxt="n", xlab="Eyeball", ylab="Measured")
mtext(1, text=df2[,1], at=1:length(df2[,1]), line = 1 , cex=.7 )
__________________________________________________________________
[[elided Yahoo spam]]
More information about the R-help
mailing list