R/utils.R

Defines functions .absent_action .convert_subset_index

.convert_subset_index <- function(subset, names) {
    if (is.character(subset)) {
        fmt <- "index out of bounds: %s"
        subset <- SummarizedExperiment:::.SummarizedExperiment.charbound(subset, names, fmt)
    }
    return(as.vector(subset))
}

.unnamed <- "unnamed"

.absent_action <- function(object, val, fun, onAbsence=c("none", "warn", "error")) {
    if (is.null(val)) {
        onAbsence <- match.arg(onAbsence)
        if (onAbsence!="none") {
            msg <- sprintf("'%s(<%s>)' returns 'NULL'", fun, class(object)[1])
            if (onAbsence=="warn") {
                warning(msg)
            } else {
                stop(msg)
            }
        }
    }
}

Try the SingleCellExperiment package in your browser

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

SingleCellExperiment documentation built on Nov. 8, 2020, 7:51 p.m.