Health History.
This data is reported via the COG1 Session. We could also use the NCI Dietary questionnaire, since this includes questions about alcohol usage. Although, we'll start at Health History Questionnaire (HHQ). Tips for finding other useful variables are integraded below.
I have already used the RedCap 'Data Export Reports & Stats' tab to download this data and place it on the server under the following: "/Volumes/IGNITE_Imaging/QC_Output/R_IGNITE/RedCap/PRE/Data/"
library(tidyverse)
library(summarytools)
library(magrittr)
library(corrplot)
setwd("/Volumes/IGNITE_Imaging/QC_Output/R_IGNITE/RedCap/PRE/Data/")
FILE<-list.files("/Volumes/IGNITE_Imaging/QC_Output/R_IGNITE/RedCap/PRE/Data/", pattern="*.r")
PATH<-"/Volumes/IGNITE_Imaging/QC_Output/R_IGNITE/RedCap/PRE/Data/"
data<-paste(PATH, FILE, sep="")
source(data)
Variable Summary
HHQ<-data %>% select(starts_with("history_"))
HHQ<-HHQ[,c(1:18)]
HHQ[, (1:18)]<-lapply(HHQ[, (1:18)], as.numeric)
print(dfSummary(HHQ, plain.ascii = TRUE,
justify="c", graph.magnif = .60,
valid.col = FALSE,
labels.col = TRUE, style = "grid",
varnumbers = FALSE, tmp.img.dir = "/tmp"),
method = 'render' )
Corr/Cov plots
HHQ<-HHQ[complete.cases(HHQ),]
M <- cor(HHQ)
Order = "hclust"
corrplot(M, method = "square", order="hclust", addrect = 2 )

Order = "First Principal Componant"
corrplot(M, method = "square", order = "FPC")

Order = "Angular Order of the Eigenvectors", conf.level = .95
res1 <- cor.mtest(HHQ, conf.level = .95)
corrplot(M, is.corr = TRUE,p.mat = res1$p, sig.level = .2, order = "AOE")

Data Exploration-
PCA (FactoMineR & factoextra packages)
Best online expamples: http://www.sthda.com/english/articles/31-principal-component-methods-in-r-practical-guide/112-pca-principal-component-analysis-essentials/
library(corrplot)
library(FactoMineR)
library(factoextra)
HHQ<-data %>% select( record_id,
starts_with("history_"))
HHQ<-HHQ[,c(2:19)]
HHQ<-HHQ[(complete.cases(HHQ)),]
HHQ.pca<-PCA(HHQ, graph = FALSE)
fviz_eig(HHQ.pca, addlabels = TRUE) ## MAN thats a shit scree plot

var <- get_pca_var(HHQ.pca)
par(mfrow=c(1,2))
fviz_pca_var(HHQ.pca, col.var = "cos2",
gradient.cols = c("#00AFBB", "#E7B800", "#FC4E07"),
repel = TRUE )

corrplot(var$cos2, is.corr=FALSE)
par(mfrow=c(1,2))

fviz_contrib(HHQ.pca, choice = "var", axes = 1)

fviz_contrib(HHQ.pca, choice = "var", axes = 2)
