library(tidyverse)
library(knitr)
library(summarytools)
library(kableExtra)
library(glue)
library(labelled)
opts_chunk$set(comment="#>", 
           warning=FALSE, 
           collapse=T,
           echo=FALSE, 
           message=FALSE, 
           results="asis", 
           cache=FALSE, 
           prompt=FALSE)
source(here("./R/hies_2016_file_info.R"))
assign("dat",get(load(here(glue("./data/HIES_2016/{rda_files_clean[i]}.rda")))))

print(glue("# {rda_files_clean[i]}"))


print(glue("## {data_file_sec[i]}"))


print(glue("### {data_file_part[i]}"))
dat_label <- dat %>% 
                       lapply(attr, which="label") %>% 
               lapply(function(x) ifelse(is.null(x), "", x)) %>% 
               unlist() %>% 
               tibble::enframe()  %>% 
               rename(var_name=name, 
                  var_label=value)
kable(dat_label, format="html")  %>% 
      kable_styling(full_width=TRUE) 

Data description

dfSummary(dat,
      labels.col = TRUE,
      plain.ascii = FALSE, 
      style= "grid",
      valid.col=FALSE,
      na.col=FALSE,
      max.distinct.values=6,
      graph.col=F)


rfaridi/hiesBD documentation built on Dec. 22, 2021, 3:05 p.m.