Getting a list of random numbers in normal distribution

2019-08-19 Rahul Swami 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))
a

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)
s

 

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

 

 

 

 

 


About author

Card image cap
Rahul Swami

Experienced in providing key insights with advanced statistical methods, data modeling, and graphical display, utilizing the software that best suits your needs, with advanced skill in R.!

-R Developer

0 Comments