Question
I was wondering if a single call of rnorm
in R base can generate two or more sets of random variables each with different n
, different mean
, and different sd
?
Details
As an example, in the below rnorm
call, I'm trying to get rnorm
to generate two sets of random variables, each with different n
, different mean
, and different sd
:
rnorm( n = c(5, 3) , mean = c(6, 4) , sd = c(2, 1) )
Since the above attempt doesn't produce the desired result, I tried to Vectorize
all the 3 arguments in the rnorm
:
rnorm.2 = Vectorize( rnorm(n , mean, sd), "n", "mean", "sd")
And I encounter: Error in rnorm(n, mean, sd) : invalid arguments
Aucun commentaire:
Enregistrer un commentaire