R/validation.R

Defines functions is_not_duplicated is_rectangular

#' @importFrom magrittr equals
#' @importFrom dplyr n
is_rectangular <- function(.data) {
    is_rectangular_sample <-
        .data %>%
        count(sample) %>%
        count(n, name="nn") %>%
        nrow() %>%
        equals(1)

    is_rectangular_transcript <-
        .data %>%
        count(transcript) %>%
        count(n, name="nn") %>%
        nrow() %>%
        equals(1)

    is_rectangular_sample & is_rectangular_transcript
}

is_not_duplicated <- function(.data) {
    .data %>%
        count(`sample`, `transcript`) %>%
        filter(n > 1) %>%
        nrow() %>%
        equals(0)
}

Try the tidySummarizedExperiment package in your browser

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

tidySummarizedExperiment documentation built on Nov. 8, 2020, 8:22 p.m.