Dear Rxperts..

what settings in barplot and histogram do I use, to show bars in an
monotonously increasing or decreasing order of the frequency of a
categorical variable?

an example is provided below..

histogram(~factor(sample(letters,200,rep=T)))

I was able to get it in 3 - 4 steps.. l
a1 <- sample(letter,200,rep=T)
a2 <- table(a1)
barplot(a2); barplot(sort(a2)) # all variables are not displayed on the
x-axis in the barplot
histogram(factor(a1)) # the resulting bars are not shown in seqentially
increasing or decreasing order

how do I use similar plots if I have data.frame...
example is shown below..

b1 <- data.frame(lets=sample(letters,200,rep=T),n=seq(200))
barplot(sort(table(b1$lets))
histogram(b1$lets)

Regards,
Santosh

        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to