R/Shuffle.R

Defines functions Shuffle

Shuffle <- function(
    x, 
    ignore=NULL
) {
    # shuffle the values in x
    # ignore should be a logical vector equal in length to x
    # for each T value in ignore, the corresponding value in x is not shuffled
    if (is.null(ignore)) ignore <- rep(FALSE, length(x))
    x[!ignore] <- sample(x[!ignore])
    x    
}
alexjcornish/SANTA documentation built on Aug. 7, 2021, 3:06 p.m.