library(ggplot2) library(pander) library(kableExtra) library(CodebookGenerator) library(DT)
codebookDF <- gss
kable(CodebookGenerator::summarizeDataFrame(codebookDF), digits=1) %>% kable_styling(bootstrap_options = c("striped", "hover","condensed"),full_width = F)
datatable(CodebookGenerator::summarizeVariables(codebookDF), escape=F, rownames=F, fillContainer=F, style="bootstrap")
tab <- variableOverview(codebookDF[["age"]]) kable(tab, digits=1) %>% kable_styling(bootstrap_options = c("striped", "hover","condensed"))
tab <- summarizeVariable(codebookDF[["age"]], "Unclassified") kable(tab, digits=1) %>% kable_styling(bootstrap_options = c("striped", "hover","condensed"))
var <- codebookDF[['age']] bw=(max(var, na.rm=T)-min(var, na.rm=T))/30 m <- mean(var, na.rm=T) sd <- sd(var, na.rm=T) n <- length(!is.na(var)) class(codebookDF[['age']]) <- NULL ggplot(data=codebookDF)+ geom_histogram(aes(age),color='black',bins=30)+ theme_minimal()+ stat_function(fun = function(x, mean, sd, n, bw){ dnorm(x = x, mean = mean, sd = sd) * bw * n}, args = c(mean = m, sd = sd, n = n, bw = bw), color='red')
tab <- variableOverview(codebookDF[["race"]]) kable(tab, digits=1) %>% kable_styling(bootstrap_options = c("striped", "hover","condensed"))
tab <- summarizeVariable(codebookDF[["race"]], "Categorical") kable(tab, digits=1) %>% kable_styling(bootstrap_options = c("striped", "hover","condensed"))
codebookDF['race_new']<-factor(codebookDF[['race']]) ggplot(data=codebookDF)+ geom_bar(aes(race_new))+ theme_minimal()
tab <- variableOverview(codebookDF[["hrs1"]]) kable(tab, digits=1) %>% kable_styling(bootstrap_options = c("striped", "hover","condensed"))
tab <- summarizeVariable(codebookDF[["hrs1"]], "Unclassified") kable(tab, digits=1) %>% kable_styling(bootstrap_options = c("striped", "hover","condensed"))
var <- codebookDF[['hrs1']] bw=(max(var, na.rm=T)-min(var, na.rm=T))/30 m <- mean(var, na.rm=T) sd <- sd(var, na.rm=T) n <- length(!is.na(var)) class(codebookDF[['hrs1']]) <- NULL ggplot(data=codebookDF)+ geom_histogram(aes(hrs1),color='black',bins=30)+ theme_minimal()+ stat_function(fun = function(x, mean, sd, n, bw){ dnorm(x = x, mean = mean, sd = sd) * bw * n}, args = c(mean = m, sd = sd, n = n, bw = bw), color='red')
tab <- variableOverview(codebookDF[["divorce"]]) kable(tab, digits=1) %>% kable_styling(bootstrap_options = c("striped", "hover","condensed"))
tab <- summarizeVariable(codebookDF[["divorce"]], "Categorical") kable(tab, digits=1) %>% kable_styling(bootstrap_options = c("striped", "hover","condensed"))
codebookDF['divorce_new']<-factor(codebookDF[['divorce']]) ggplot(data=codebookDF)+ geom_bar(aes(divorce_new))+ theme_minimal()
tab <- variableOverview(codebookDF[["martype"]]) kable(tab, digits=1) %>% kable_styling(bootstrap_options = c("striped", "hover","condensed"))
tab <- summarizeVariable(codebookDF[["martype"]], "Categorical") kable(tab, digits=1) %>% kable_styling(bootstrap_options = c("striped", "hover","condensed"))
codebookDF['martype_new']<-factor(codebookDF[['martype']]) ggplot(data=codebookDF)+ geom_bar(aes(martype_new))+ theme_minimal()
tab <- variableOverview(codebookDF[["marital"]]) kable(tab, digits=1) %>% kable_styling(bootstrap_options = c("striped", "hover","condensed"))
tab <- summarizeVariable(codebookDF[["marital"]], "Categorical") kable(tab, digits=1) %>% kable_styling(bootstrap_options = c("striped", "hover","condensed"))
codebookDF['marital_new']<-factor(codebookDF[['marital']]) ggplot(data=codebookDF)+ geom_bar(aes(marital_new))+ theme_minimal()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.