Skip to content

Histogram + % of cases for a given criteria

1 message · S. Nunes

#
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