R/dic_haven.R

Defines functions dic_haven

Documented in dic_haven

#' Create haven labels and value labels from dic
#'
#' @param data A data frame containing dic information
#'
#' @return A data frame with haven labels and value labels
#' @export
dic_haven <- function(data) {
  for(i in .get_dic_items(data, items_only = FALSE)) {
    attr(data[[i]], "label") <- dic_attr(data[[i]], .opt$item_label)
    attr(data[[i]], "labels") <- dic_attr(data[[i]], .opt$values)
  }
  data
}
jazznbass/scaledic documentation built on Sept. 20, 2021, 7:43 p.m.