[R] Histogram + % of cases for a given criteria

S. Nunes snunes at gmail.com
Wed May 13 16:54:38 CEST 2009


Hi all,

I am doing some explorations using a dataset with the following
structure (id, value, flag).
For instance:

a, 2.2, 1
b, 3.0, 1
c, 2.9, 0
d, 3.1, 1
...

I have plotted a standard histogram using a simple command like:
hist(data$value)

My question:

I would like to superimpose a line ([0%-100%] scale) representing the
% of values that, for each class of the histogram, have the $flag
equal to 1.

What strategy do you recommend? Is this easily doable in R?

I hope I made myself clear. Please let me know if not.

Thanks in advance,
--
Sérgio Nunes




More information about the R-help mailing list