R/clear-all-df-labels.R

Defines functions clear_all_df_labels

Documented in clear_all_df_labels

#' Remove all labels from a df
#'
#' e.g. after using a function in Hmisc that tacks on labels, or
#' haven::read_dta()
#'
#' @param df df to remove labels from
#'
#' @return df with labels removed
#' @export
clear_all_df_labels <- function(df) {
  for(cc in names(df)) {
    attr(df[[cc]],"label") <- NULL
  }
  return(df)
}
rdisalv2/dismisc documentation built on Nov. 2, 2021, 1:34 a.m.