Create 1-data-exploration.R
This commit is contained in:
parent
b19d1f25eb
commit
c629848502
1 changed files with 44 additions and 0 deletions
44
ML/1-data-exploration.R
Normal file
44
ML/1-data-exploration.R
Normal file
|
@ -0,0 +1,44 @@
|
|||
rm(list = ls(all.names = TRUE)) # Clear the memory of variables from previous run.
|
||||
cat("\014") # Clear the console
|
||||
|
||||
|
||||
# load packages -----------------------------------------------------------
|
||||
|
||||
box::use(
|
||||
magrittr[`%>%`]
|
||||
,here[here]
|
||||
,dplyr
|
||||
,readr
|
||||
,tidyr
|
||||
,ggplot2
|
||||
)
|
||||
|
||||
|
||||
|
||||
|
||||
# load data ---------------------------------------------------------------
|
||||
|
||||
ds_high_tsh <- readr$read_rds(
|
||||
here("ML","data-unshared","ds_high_tsh.RDS")
|
||||
)
|
||||
|
||||
|
||||
|
||||
# data manipulation -------------------------------------------------------
|
||||
|
||||
#here I am adding a column to determine if the Free T4 Value is diagnostic or not
|
||||
# using the FT4 Referance range low as the cut off (0.93)
|
||||
|
||||
|
||||
ds_high_tsh <- ds_high_tsh %>%
|
||||
dplyr$mutate(ft4_dia = dplyr$if_else(`50995` < 0.93, 1, 0))
|
||||
|
||||
|
||||
|
||||
# basic visualization -----------------------------------------------------
|
||||
|
||||
g1 <- ds_high_tsh %>%
|
||||
dplyr$select(-subject_id, - charttime) %>%
|
||||
dplyr$mutate(dplyr$across(gender, ~dplyr$recode(.,M = 1, F = 2))) %>%
|
||||
tidyr$pivot_longer(cols = dplyr$everything()) %>%
|
||||
|
Loading…
Reference in a new issue