Calling rnorm with a vector of means
问题 When I call rnorm passing a single value as mean, it's obvious what happens: a value is generated from Normal(10,1). y <- rnorm(20, mean=10, sd=1) But, I see examples of a whole vector being passed to rnorm (or rcauchy , etc..); in this case, I am not sure what the R machinery really does. For example: a = c(10,22,33,44,5,10,30,22,100,45,97) y <- rnorm(a, mean=a, sd=1) Any ideas? 回答1: The number of random numbers rnorm generates equals the length of a. From ?rnorm : n: number of observations.