On 18 Nov 2003 10:29:50 -0500, "Arend P. van der Veen"
<[EMAIL PROTECTED]> wrote :

>Hi,
>
>I have what should be a simple question.  I would like to generate a
>histogram of
>
>x <- c("a","b","c","b","c","c")
>
>where the first bar to be labeled 'c' with height 3, second bar to be
>labeled 'b' with height 2 and third bar to be labeled 'a' with height 1.
>
>This should be an easy task in R but I think I am missing something?

Try  barplot(rev(table(x))).

You use table() to calculate frequencies of discrete classes (and
hist() to count frequencies of different bins for continuous
variables), rev() to reverse the order from the natural order, and
barplot() to plot the bars.

Duncan Murdoch

______________________________________________
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help

Reply via email to