R/content_checks.R

Defines functions is.binary is.constant

Documented in is.binary is.constant

#' Contents of Vector Checks
#'
#' Misc/useful functions to easily determine what is contained in a vector.
#'
#' @param x object to be tested
#'
#' @return a logical value
#'
#' @name content_checks
NULL

#' @rdname content_checks
#' @export
is.constant <- function(x){
  n_unique_cc(x) <= 1
}

#' @rdname content_checks
#' @export
is.binary <- function(x){
  n_unique_cc(x) <= 2
}

Try the roperators package in your browser

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

roperators documentation built on Feb. 10, 2022, 1:07 a.m.