Re: [R] Simulating data, loop

2010-10-29 Thread Ivan Calandra
Hi Sarah, There is one thing you need to think about: how do you choose which values should not be removed if you have more than 20 and which should be if you have less than 20. In my code, I've just done it with sample(), which might not be what you need. Here is what I have: if (length(whi

[R] Simulating data, loop

2010-10-29 Thread Sarah
Hello, I would like to run a script in which a loop is included. Since I'm new to R, I cannot manage the following problem. I really hope someone could help me out. Data in the variable Y should be removed from the simulated data set with probability 0.50 if the variable X has a value below zero