Reputation: 1947
I know that if I want to generate for example 120 numbers from normal distribution with mean 30 and standard deviation 20 i can do it by command :
x=rnorm(120,30,20)
But what if I want to generate 100 times 120 numbers from above normal distribution ?
Do we have in R any function to do this directly ?
Upvotes: 2
Views: 822
Reputation: 581
As proposed by @duckmayr
replicate(100, rnorm(120, 30, 20), simplify = TRUE) # if you want to generate a matrix
replicate(100, rnorm(120, 30, 20), simplify = FALSE) # if you want to generate a list
Upvotes: 1