11.6 Random glucose
UK Biobank measurements for glucose range from 0.995 to 36.813 mmol/L. We filter the allowable range of fasting glucose to be under 60, but not 0.
<- gp_clinical %>%
randgluc filter(grepl(randgluc_codes, code)) %>%
mutate(randgluc = coalesce(as.numeric(value1), as.numeric(value2), as.numeric(value3))) %>%
filter(randgluc > 0 & randgluc < 60) %>%
filter(value3 %in% c("", "MEA000", "MEA061", "MEA096", "MEA194", "Mmol/L",
"Unknown", "mmol/L", "mmol/l", "mU/l", "units"))
%>% group_by(code, term_description) %>%
randgluc summarize(n=n(), mean = mean(randgluc, na.rm=T)) %>%
arrange(desc(n)) %>% kable()
ggplot(data = randgluc, aes(x=log10(randgluc))) + geom_density() + theme_minimal()