Hello Richie, I would like to do three (or k) swap steps in each step just 2 ID recursive swaping x <- 1:10 swap <- function(x){  a <- sample(x,2)  x[x==a[1]] <- swap[2]  x[x==a[2]] <- swap[1]  return(x)  }  swap(swap(swap(x))) -> mix  Is this possible? Thanks you in advance! Amor
__________________________________________________ Schutz gegen Massenmails. [[alternative HTML version deleted]]
______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.