Re: [R] generating many matrices

From: jim holtman <jholtman_at_gmail.com>
Date: Wed, 06 Jun 2007 09:32:43 -0400

Is this what you want?

x <- diag(4) # 4x4 matrix
result <- list() # list to store the 100 matrices for (i in 1:100){

    diag(x) <- runif(4) # fill with random values     result[[i]] <- x # save the result
}

On 6/5/07, Keun-Hyung Choi <khchoi_at_sfsu.edu> wrote:
>
> I'd like to generate many matrices (let's say 100 matrices of 4x4), of
> which
> diagonal elements are being drawn from each set of sample of known
> distribution.
>
> What would be the best way? I've been trying to find any previous threads
> for this topic, but haven't been able to find one.
>
>
>
> Thanks. Kevin
>
>
>
>
>
>
> [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help_at_stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

-- 
Jim Holtman
Cincinnati, OH
+1 513 646 9390

What is the problem you are trying to solve?

	[[alternative HTML version deleted]]

______________________________________________
R-help_at_stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Received on Wed 06 Jun 2007 - 13:51:47 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Wed 06 Jun 2007 - 14:31:59 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.