R/details.R

#' @importFrom crayon yellow silver green red blue cyan
#' @export
setMethod(
  "details",
  c(obj = "ANY"),
  function(obj) {
    print(obj)
  }
)

#' @export
setMethod(
  "details",
  c(obj = "CrunchDataset"),
  function(obj) {
    cat(yellow(name(obj)), "\n")
    dims <- dim(obj)
    cat(silver(paste0(dims[1], " x ", dims[2])), "\n")
    print(exclusion(ds))
  }
)

#' @export
setMethod(
  "details",
  c(obj = "CategoricalVariable"),
  function(obj) {
    cat(yellow(name(obj)), "\n")
    cat(silver(type(obj)), "\n")
    print(
      categories(obj)
    )
  }
)


#' @export
setMethod(
  "details",
  c(obj = c("CategoricalArrayVariable")),
  function(obj) {
    cat(yellow(name(obj)), "\n")
    cat(silver(type(obj)), "\n")
    print(
      categories(obj)
    )
    print(
      data.frame(
        names = names(subvariables(obj)),
        aliases = aliases(subvariables(obj))
      )
    )
  }
)
domjarkey/crunchscripts documentation built on June 6, 2019, 7:43 p.m.