0

Histogram that I want to make

How do I create a histogram with a probability y-axis rather than frequency y-axis in R

I'm very new to R, so I apologize in advance.

Do I need to calculate the probability first with a function in R. And then, input the result in the probability histogram function?

or there is a function in R that can calculate all at once? (Please help me with the function)

Here is my data

 sample(rep(1:10, each=10))


  [1]  6  1  7  7  9  9  3  4  6  1  1  2 10  5  9  7  8  5  3  6  1  4  4  2  2
 [26]  6  3 10  7  8  1  2  2  9  5  9  5  2  2  8  6  6 10  9  3 10  8  5  5 10
 [51]  8  9  7 10  4  1  3 10  1  3  7  2  2  2  9  8  7  8  8  1  1  3  9  8  7
 [76]  6  6  3  9  4  4  1 10  8  3  6  5  7  7  5  6 10  5  5  3  4 10  4  4  4

Fyi, I have a task about the discrete uniform distribution

Jonathan
  • 1
  • 2

1 Answers1

0

All you have to do is divide by you numbers by the total numbers of observations. Frequency/count = probability. So just run a histogram with this new variable.

Austin Graves
  • 1,044
  • 5
  • 12