I have a quick question. This is my function for vector x1:
x1 <- rbinom (100, 1, .5)
I need to have 3 more vectors, x2, x3, and x4 which look like this too:
x2 <- rbinom (100, 1, .5)
x3 <- rbinom (100, 1, .5)
x4 <- rbinom (100, 1, .5)
However, this gives me random distributions. What I want is to have these 4 separate vectors, but they're dependent on each other. I need to get something like this:
x1: 1 0 0 0 1 0 1 0 1 0
x2: 0 0 0 1 0 0 0 0 0 1
x3: 0 1 0 0 0 0 0 1 0 0
x4: 0 0 1 0 0 1 0 0 0 0
In other words, if there's 1 in x1 on the first spot, there need to be 0s in the first spot in x1, x2, and x3.
Thank you very much!
Aucun commentaire:
Enregistrer un commentaire