Update 1-data-exploration.R
This commit is contained in:
parent
b2bffd959b
commit
2cc710650b
1 changed files with 16 additions and 6 deletions
|
@ -116,25 +116,35 @@ g1 <- ds1 %>%
|
||||||
# this takes a bit to load. No discernable paterns in the data
|
# this takes a bit to load. No discernable paterns in the data
|
||||||
g2 <- ds_recode %>%
|
g2 <- ds_recode %>%
|
||||||
dplyr$select(-gender) %>%
|
dplyr$select(-gender) %>%
|
||||||
|
dplyr$mutate(dplyr$across(-ft4_dia, log)) %>%
|
||||||
tidyr$pivot_longer(cols = !ft4_dia) %>%
|
tidyr$pivot_longer(cols = !ft4_dia) %>%
|
||||||
ggplot(aes(x = factor(ft4_dia), y = value, fill = factor(ft4_dia))) +
|
ggplot(aes(x = factor(ft4_dia), y = value, fill = factor(ft4_dia))) +
|
||||||
gp2$geom_boxplot(outlier.shape = NA, na.rm = TRUE) +
|
gp2$stat_boxplot(geom = "errorbar", na.rm = TRUE) +
|
||||||
gp2$geom_jitter(size=.7, width=.1, alpha=.5, na.rm = TRUE) +
|
gp2$geom_boxplot(na.rm = TRUE, outlier.shape = NA) +
|
||||||
gp2$facet_wrap(~name, scales = "free") +
|
gp2$facet_wrap(~name, scales = "free") +
|
||||||
gp2$theme_bw() +
|
gp2$theme_bw() +
|
||||||
gp2$scale_fill_brewer(
|
gp2$scale_fill_brewer(
|
||||||
palette = "Greys"
|
palette = "Greys"
|
||||||
,labels = c("Hypo","Non-Hypo","Normal TSH","Hyper","Non-Hyper")
|
,labels = c("1 - Hypo","2 - Non-Hypo","3 - Normal TSH","4 - Hyper","5 - Non-Hyper")
|
||||||
) +
|
) +
|
||||||
gp2$labs(
|
gp2$labs(
|
||||||
x = NULL
|
x = NULL
|
||||||
,y = NULL
|
,y = NULL
|
||||||
,fill = "Lab Diagnosis"
|
,fill = "Lab Diagnosis"
|
||||||
|
,caption = "All values log transformed"
|
||||||
)
|
)
|
||||||
|
|
||||||
# g2
|
# g2
|
||||||
|
gp2$ggsave(
|
||||||
gp2$ggsave(here("figures","boxplot.png"), width = 7, height = 7, dpi = 300)
|
here("figures","boxplot.emf")
|
||||||
|
,width = 7
|
||||||
|
,height = 7
|
||||||
|
,dpi = 300
|
||||||
|
,device = devEMF::emf
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue