ustroetz
ustroetz

Reputation: 6312

How to plot histogram in R based on frequency

Lets say I have a table like this

Count   MyValue
1       1
2       2
3       3
4       4
5       5
5       6
4       7
3       8
2       9
1       10

If I create a histogram of MyValue it looks like this: enter image description here

What I want is a histogram of MyValue that, that also considers the Count. It should look like this:enter image description here

Upvotes: 0

Views: 96

Answers (1)

Roland
Roland

Reputation: 132999

It is unclear what you expect as the result, but maybe this:

hist(rep(DF$MyValue, DF$Count))

Upvotes: 2

Related Questions