R/randBatch.R

Defines functions randBatch

randBatch <- function(d) {
    
    lst <- lapply(split(seq_len(nrow(d)), d$date), function(x) {
        x[sample.int(length(x))]
    })
    
    d <- d[unlist(lst, use.names = FALSE), ]
    rownames(d) <- NULL
    return(d)
}
TRUE
TRUE

Try the onlineFDR package in your browser

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

onlineFDR documentation built on Nov. 8, 2020, 6:35 p.m.