R/class_kibble.R

Defines functions kibble new_kibble

Documented in kibble

# CONSTRUCTORS FOR KIBBLE CLASS

#' @importFrom tibble tibble new_tibble
#' @importFrom assertthat assert_that
new_kibble <- function(df = tibble(),
                       survey = NA,
                       choices = NA) {
  assert_that(is.data.frame(df))
  new_tibble(df,
             survey = survey,
             choices = choices,
             nrow = nrow(df),
             class = "kibble")
}

#' Kibble constructor
#'
#' `kibble()` constructs a kibble data frame.
#'
#' @export
kibble <- function(df = tibble(),
                   survey = NA,
                   choices = NA) {
  new_kibble(df,
             survey = survey,
             choices = choices)
}
caldwellst/koborg documentation built on May 29, 2020, 3:04 a.m.