R/utils_subset.R

Defines functions .col_subset_to_index .row_subset_to_index

#' @importFrom S4Vectors normalizeSingleBracketSubscript
.row_subset_to_index <- function(x, index) {
    if (is.null(index)) {
        seq_len(nrow(x))
    } else {
        normalizeSingleBracketSubscript(index, x)
    }
}

.col_subset_to_index <- function(x, index) {
    if (is.null(index)) {
        seq_len(ncol(x))
    } else {
        i <- seq_len(ncol(x))
        names(i) <- colnames(x)
        unname(i[index])
    }
}

Try the batchelor package in your browser

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

batchelor documentation built on April 17, 2021, 6:02 p.m.