Submitted by : Rahul Swami
Programming Tutorials: R Programming
Posted on : 13-08-2019 09:27:34p

Download Code
a <- floor(rnorm(10000, 500, 100))

In a normal distribution, the first row produces a list of 10,000 random numbers so that the mean of those numbers is 500 and the standard deviation is 100.

In this list, the floor function takes each number and removes the decimal point.

In the R console you can even attempt to run this code individually and see the output as:

a <- floor(rnorm(10000, 500, 100))

Counting occurrences of each value

The table feature requires these numbers 10,000 and counts each frequency

a <- floor(rnorm(10000, 500, 100))
s <- table(a)


Since it is a normal distribution, as we approach the mean, you can obviously see the number frequencies gradually rise.