R/repeat.data.R

repeat.data <- function (Data, times){
    result <- list()
    if(times < 1){
        stop("times cannot be <1 !")
    }
    if (is.null(rownames(Data)))
        rownames(Data) <- 1:nrow(Data)
    repeated <- Data
    if(times >1){
        for (ind in 1:(times - 1)) {
            Datai <- Data
            rownames(Datai) <- paste(rownames(Data), ind, sep="-")
            repeated <- rbind(repeated, Datai)
        }
    }
    result[["Data"]] <- Data
    result[["repeated"]] <- repeated
    return(result)
}

Try the Pigengene package in your browser

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

Pigengene documentation built on Nov. 8, 2020, 6:47 p.m.