R/print.R

Defines functions print.likerrt_labels print.likerrt_label

#' @importFrom haven as_factor
#' @export
haven::as_factor

#' @export
print.likerrt_labels <- function(x, ...) {
  nx <- names(x)
  if(is.null(nx)) {
    nx <- rep(NA, length(x))
  }
  d <- data.frame(value = unclass(x), label = nx, stringsAsFactors = FALSE)
  print(d, row.names = FALSE)
}

#' @export
print.likerrt_label <- function(x, ...) {
  cat(" label:\n")
  cat("   ", x, sep = "")
  cat("\n")
}
Gootjes/likerrt documentation built on April 3, 2020, 7:29 a.m.