[R] Frequency ploygon help
Robert W. Baer, Ph.D.
rbaer at atsu.edu
Sun Mar 7 22:50:01 CET 2004
I can't figure out how to get the x-axis to contain the category lables for
my frequency polygon. I'm also not sure if there is a more elegant
approach. Any insights on the labels?
I tried this:
#generate some pseudo data
x=c(sort(sample(1:1500,5)),sort(sample(1:1500,3),dec=T))
# assign names to the vector
names(x)=c("0-13","14-19","50-99","100-149","150-199","200-249","250-299","3
00+")
#Plot a frequency polygon
# This displays as inicies, not labels:
plot(x,type="b",col="red")
#This almost works (adds labels) but produces errors and scrambles y-axis
plot(x,type="b",col="red",labels=labels(x))
I looked at ?axis but could not see a solution there. Thanks in advance.
Rob
More information about the R-help
mailing list