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(F, length(x))
    x[!ignore] <- sample(x[!ignore])
    x    
}

Try the SANTA package in your browser

Any scripts or data that you put into this service are public.

SANTA documentation built on Oct. 31, 2019, 3:21 a.m.