Skip to content
Prev 78975 / 398502 Next

How to generate for one vector matrix

A not-so-clever solution:

n <- 6
x <- c(4,2,3,1,4)
y <- matrix(0, nrow=n, ncol=length(x))
for (i in 1:n){
for (j in 1:length(x)){
y[i,j] <- round(runif(1,min=0,max=x[j]))}}

Hope it helps
Xiaohua
On 10/13/05, Jan Sabee <jan.sabee at gmail.com> wrote:
--
Xiaohua Dai, Dr.
Postdoc in elephant-vegetation ecosystem simulation
Centre for Systems Research, Durban Institute of Technology
P.O.Box 953, Durban 4000, South Africa