R/metadata.R

Defines functions cn rn nas naCount

Documented in cn nas rn

#' Tabular Objects Metadata
#'
#' @description type less - tabular objects metadata
#'
#' @section Functions:
#'
#' \describe{
#'   \item{`cn()`}{cn is a shorthand for the base function colnames}
#'
#'   \item{`rn()`}{rn is a shorthand for the base function row.names}
#'
#'   \item{`nas()`}{count the number of NA values in a given
#'   tabular object}
#' }
#'
#' @seealso \code{colnames} and \code{row.names} in base package
#'
#' @param df dataframe object
#'
#' @name metadata
#' @examples
#' cn(iris)
#' rn(mtcars)
#' nas(airquality)
NULL

#' @rdname metadata
#' @export
cn <- function(df) colnames(df)

#' @rdname metadata
#' @export
rn <- function(df) row.names(df)

#' @rdname metadata
#' @export
nas <- function(df) lapply(df, naCount)

# implicit function
naCount <- function(x) length(which(is.na(x)))
ShaulAb/typeless documentation built on May 28, 2019, 3:15 p.m.