Re: [R] While loop set up

2008-11-18 Thread bartjoosen
Hello Rodrigo, You're almost there: you should make the variable distance before the while loop, and this should be higher than 14 to go inside the while loop: selectmarkers<- function(n=10){ tapply(mm$marker, mm$chr, function(m){ distances <- 15 while (max(distances) > 14) {

[R] While loop set up

2008-11-18 Thread Rodrigo Gularte
I am attempting to sample 10 markers from each chr, with a maximum distance of 14, calculated by the location of the marker in each chromosome as loc[i+1] - loc[i]. I presume the easiest way to do this is with a while loop, so that the function keeps resampling when the max distains is greater tha