From 07de043cab4a2db8b6735b2148f8ba8e6603d97e Mon Sep 17 00:00:00 2001 From: Tanushree Tunstall Date: Wed, 18 Nov 2020 13:06:36 +0000 Subject: [PATCH] updated read_data.R to return fp_adults as well --- data_extraction_formatting_clinical.R | 39 ++++++--------------------- read_data.R | 7 ++++- 2 files changed, 14 insertions(+), 32 deletions(-) diff --git a/data_extraction_formatting_clinical.R b/data_extraction_formatting_clinical.R index c6c5add..cff9075 100644 --- a/data_extraction_formatting_clinical.R +++ b/data_extraction_formatting_clinical.R @@ -10,10 +10,15 @@ getwd() # Input: source data #==================== source("read_data.R") - +source("reg_cols_extraction.R") +######################################################################## +#========== +# +#========== # extract the flu positive population fp_adults = adult_df[adult_df$flustat == 1,] +######################################################################## table(adult_df$ia_exac_copd) table(adult_df$ia_exac_copd==1 & adult_df$asthma == 1) # check this is 4 @@ -22,37 +27,9 @@ table(fp_adults$ia_exac_copd==1 & fp_adults$asthma == 1) # check this is 3 # clear unnecessary variables rm(all_df) rm(adult_df) + + ######################################################################## -cols_to_extract = c("mosaic" - , "ia_exac_copd" - , "death" - #, "obese2" #inc peaeds, but once you subset data for adults, its the same! - , "obesity" - , "flustat" - , "sfluv" - , "h1n1v" - , "age" - , "gender" - , "asthma" - , "vl_pfu_ul_npa1" - , "los" - , "onset2final" - , "onsfindeath" - , "onset_2_initial" - , "o2_sat_admis" - , "o2_sat_suppl" - , "ethnicity" - , "smoking" - , "ia_cxr" - , "max_resp_score" - , "T1_resp_score" - , "com_noasthma" - , "T2_resp_score" - , "inresp_sev" - , "steroid") - -#npa_data = - reg_data = fp_adults[, cols_to_extract] # sanity checks diff --git a/read_data.R b/read_data.R index 0cec4e9..de96a05 100755 --- a/read_data.R +++ b/read_data.R @@ -43,7 +43,6 @@ all(meta_data_cols%in%colnames(all_df)) metadata_all = all_df[, meta_data_cols] - #============== # adult patients #============== @@ -56,6 +55,12 @@ if (table(adult_df$adult == 1)[[1]] == nrow(adult_df) ){ cat ("FAIL: adult df number mismatch!") } +#============== +# FLU positive: adult patients +#============== +# extract the flu positive population +fp_adults = adult_df[adult_df$flustat == 1,] + #============ # hc #============