How to create a variable x with distribution N~(0, σ^2x)?

Want to create a variable x using rnorm, but not sure how to represent the standard deviation in code.

Help would be appreciated thanks!

x <- rnorm(n = 100, mean = 0, sd = 1)

This will give you a vector x of length 100 distributed normally with a mean of 0 and a standard deviation of 1. You can use ? preceding any R function to pull up the help documentation. For example: ?rnorm().

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.