R/logical.R

Defines functions logical_

Documented in logical_

#' Logical generator
#'
#' A generator for logical vectors.
#'
#' @template len
#' @template any_na
#'
#' @examples
#' logical_() %>% show_example()
#' logical_(len = 10L, any_na = TRUE) %>% show_example()
#' @template generator
#' @export
logical_ <- function(len = c(1L, 10L), any_na = FALSE) {
  qc_gen(function(len2 = len)
    hedgehog::gen.element(c(TRUE, FALSE)) %>%
      replace_some_with(NA, any_na) %>%
      vectorize(len2)
  )
}

Try the quickcheck package in your browser

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

quickcheck documentation built on Oct. 12, 2023, 1:08 a.m.