I want to create two vectors in R that contain values randomly drawn from a uniform distribution given a specified condition, that is for example if the number in vector A is < 50 then the number in vector B should be greater than 50.
I use this code but it is applied only on the first element of the vectors
nrows = 20
A = NaN*matrix(1, nrows, 1)
B = NaN*matrix(1, nrows, 1)
repeat {
A[] = round(runif(nrows, 10, 100), digits =2)
B[] = round(runif(nrows, 10, 100), digits =2)
if(A > 50 & B > 50) {
break
}
}