SunWuKung - 8 months ago 52

R Question

I would like to draw a sample from a normal distribution such that its mean is eg. 1.

How could I do this in R?

(I saw many examples with discrete distributions but not for continuous.)

Answer

To get 1000 samples

```
samples <- rnorm(1000, mean=1, sd=1)
```

After some clarification, that the sample should be skewed normal

```
library(sn)
rsn(n=1000, xi=0, omega=1, alpha=0, tau=0, dp=NULL)
```

Source (Stackoverflow)