Update 1-data-exploration.R
This commit is contained in:
parent
4f26db1134
commit
9e5ceda638
1 changed files with 29 additions and 5 deletions
|
@ -82,19 +82,43 @@ summary_tbl <- ds1 %>%
|
||||||
gtsummary$modify_header(label = "**Variable**") %>%
|
gtsummary$modify_header(label = "**Variable**") %>%
|
||||||
gtsummary$modify_spanning_header(gtsummary$all_stat_cols() ~ "**Free T4 Outcome**")
|
gtsummary$modify_spanning_header(gtsummary$all_stat_cols() ~ "**Free T4 Outcome**")
|
||||||
|
|
||||||
|
|
||||||
|
summary_tbl <- ds1 %>%
|
||||||
|
dplyr$select(-subject_id, -charttime) %>%
|
||||||
|
gtsummary$tbl_summary(
|
||||||
|
by = ft4_dia
|
||||||
|
,missing = "no"
|
||||||
|
,type = gtsummary$all_continuous() ~ "continuous"
|
||||||
|
,label = list(
|
||||||
|
gender ~ "Gender"
|
||||||
|
,anchor_age ~ "Age"
|
||||||
|
)
|
||||||
|
,statistic = gtsummary$all_continuous() ~ c("{p_miss}{median}" )
|
||||||
|
) %>%
|
||||||
|
# gtsummary$bold_labels() %>%
|
||||||
|
gtsummary$modify_header(label = "**Variable**") %>%
|
||||||
|
gtsummary$modify_spanning_header(gtsummary$all_stat_cols() ~ "**Free T4 Outcome**") %>%
|
||||||
|
|
||||||
|
|
||||||
# summary_tbl
|
# summary_tbl
|
||||||
|
|
||||||
#code for saving corr plot
|
#code for saving corr plot
|
||||||
devEMF::emf(here("figures","corrplot.emf"))
|
devEMF::emf(here("figures","corrplot.emf"))
|
||||||
corr_plot <- cor(
|
corr_data <- cor(
|
||||||
ds1 %>% dplyr$select(-gender,-ft4_dia, -subject_id, -charttime)
|
ds1 %>% dplyr$select(-gender,-ft4_dia, -subject_id, -charttime)
|
||||||
,use = "complete.obs"
|
,use = "complete.obs"
|
||||||
) %>%
|
)
|
||||||
corrplot::corrplot(method = "color", type = "lower", tl.col = "black", tl.srt = 45
|
corrplot::corrplot(corr = corr_data,
|
||||||
,col = corrplot::COL1("Greys"), addCoef.col = 'white')
|
method = "color"
|
||||||
|
,type = "lower"
|
||||||
|
,tl.col = "black"
|
||||||
|
,tl.srt = 45
|
||||||
|
,number.font =
|
||||||
|
,col = corrplot::COL1("Greys")
|
||||||
|
,addCoef.col = 'white'
|
||||||
|
)
|
||||||
dev.off()
|
dev.off()
|
||||||
|
|
||||||
|
|
||||||
#quick recode of gender, will still do recoding during feature engineering
|
#quick recode of gender, will still do recoding during feature engineering
|
||||||
g1 <- ds1 %>%
|
g1 <- ds1 %>%
|
||||||
dplyr$select(-gender,-ft4_dia, -subject_id, -charttime) %>%
|
dplyr$select(-gender,-ft4_dia, -subject_id, -charttime) %>%
|
||||||
|
|
Loading…
Reference in a new issue