How to generate random values from a normal distribution with specific mean in R -
i have book equation, not sure how translate code in r. wondering if provide example.
i want generate random values distribution.
you can use rnorm
generate random values:
set.seed(100) mu <- 5 # or whatever mean n <- 10 # number of random values wish generate. x <- rnorm(n, mean = mu) #the function's default standard deviation 1 x [1] 4.497808 5.131531 4.921083 5.886785 5.116971 5.318630 4.418209 5.714533 [9] 4.174741 4.640138
Comments
Post a Comment