[R] Is there a function to plot a Pareto diagram?

Mark Myatt mark at myatt.demon.co.uk
Thu Jan 31 11:45:34 CET 2002


hzi at uol.com.br writes:
>Hi-
>
>       Is there a quick way to plot a Pareto diagram?
>       I couldn't find one. I'm being forced to do some pretty weird stuff,
>       with awk and all, to extract data in order to plot the frequency of
>       qualitative data from a larger set. Perhaps it's just my GNUrance.
>       I mean, one day, if I have time, I might even write a generic Perl 
>script,
>       but right now, it doesn't look too good on the client side, if you know
>       what I mean.

It's a matter of sorting in revers order the values in a table and
passing that to barplot():

        barplot(rev(sort(table(my.variable))))

as in:

        data(attenu)
        barplot(rev(sort(table(attenu$event))))

Get rid of the colours using the col parameter:

        barplot(rev(sort(table(attenu$event))), col = "white")

I hope that helps,

Mark

--
Mark Myatt


-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list