Hi ,

I was trying to generate random data in R using the runif function. But 
I am not sure how do I combine the x and y to get a 2d array/matrix in a 
variable z.
As seen below I am getting the same numbers in x as 1 and in y as 2.1 
respectively. I would like to get different & random numbers in x & y.

Please let me know.

x <- array(runif(N,1),dim=c(N,1))
 > x
     [,1]
[1,]    1
[2,]    1
[3,]    1
[4,]    1
[5,]    1
[6,]    1
[7,]    1
[8,]    1
[9,]    1
[10,]    1
 > y <- array(2*x + runif(N,1)/10)
 > y
[1] 2.1 2.1 2.1 2.1 2.1 2.1 2.1 2.1 2.1 2.1

Thanks & Regards,
Shweta.

_______________________________________________
R-SIG-GUI mailing list
R-SIG-GUI@stat.math.ethz.ch
https://stat.ethz.ch/mailman/listinfo/r-sig-gui

Reply via email to