Re: [R] matrix of random variables from a matrix of means and matrix of sd

2013-05-24 Thread M M
Nice one - didn't think of the array at all as my brain was fixated on lists... Thanks, Murali > Date: Fri, 24 May 2013 21:54:22 +0100 > From: ruipbarra...@sapo.pt > To: fean...@hotmail.com > CC: r-help@r-project.org > Subject: Re: [R] matrix of random variables from a matrix

Re: [R] matrix of random variables from a matrix of means and matrix of sd

2013-05-24 Thread Rui Barradas
Hello, The first instruction doesn't call rnorm just once but it seems more appropriate for your problem; The second instruction calls rnorm just once. set.seed(59187) res1 <- replicate(10, matrix(rnorm(4, mean = a, sd = b), ncol = 2)) set.seed(59187) res2 <- array(rnorm(40, mean = a, sd = b