R/check_statistics.R

Defines functions check_statistics

Documented in check_statistics

#' Checks the output of function statistics
#'
#'
#' Checks the output of function \code{\link{statistics}}.
#'
#'
#'
#' @param  x Result of function \code{statistics}.
#' @return \code{TRUE} if \code{x} has the following properties:
#' \code{x} is a named list with length > 0.
#' The names of the list must not have duplicates.
#' The names may contain NA. Else an error.



check_statistics <- function(x) {
    stopifnot(is.list(x), length(x) > 0)

    the_names <- names(x)
    stopifnot(!is.null(the_names), anyDuplicated(the_names) == 0)

    return(TRUE)
}

Try the atable package in your browser

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

atable documentation built on Sept. 17, 2023, 5:06 p.m.