updated read_data.R to return fp_adults as well
This commit is contained in:
parent
12eee6923a
commit
07de043cab
2 changed files with 14 additions and 32 deletions
|
@ -10,10 +10,15 @@ getwd()
|
||||||
# Input: source data
|
# Input: source data
|
||||||
#====================
|
#====================
|
||||||
source("read_data.R")
|
source("read_data.R")
|
||||||
|
source("reg_cols_extraction.R")
|
||||||
|
########################################################################
|
||||||
|
#==========
|
||||||
|
#
|
||||||
|
#==========
|
||||||
# extract the flu positive population
|
# extract the flu positive population
|
||||||
fp_adults = adult_df[adult_df$flustat == 1,]
|
fp_adults = adult_df[adult_df$flustat == 1,]
|
||||||
|
|
||||||
|
########################################################################
|
||||||
table(adult_df$ia_exac_copd)
|
table(adult_df$ia_exac_copd)
|
||||||
table(adult_df$ia_exac_copd==1 & adult_df$asthma == 1) # check this is 4
|
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
|
# clear unnecessary variables
|
||||||
rm(all_df)
|
rm(all_df)
|
||||||
rm(adult_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]
|
reg_data = fp_adults[, cols_to_extract]
|
||||||
|
|
||||||
# sanity checks
|
# sanity checks
|
||||||
|
|
|
@ -43,7 +43,6 @@ all(meta_data_cols%in%colnames(all_df))
|
||||||
|
|
||||||
metadata_all = all_df[, meta_data_cols]
|
metadata_all = all_df[, meta_data_cols]
|
||||||
|
|
||||||
|
|
||||||
#==============
|
#==============
|
||||||
# adult patients
|
# adult patients
|
||||||
#==============
|
#==============
|
||||||
|
@ -56,6 +55,12 @@ if (table(adult_df$adult == 1)[[1]] == nrow(adult_df) ){
|
||||||
cat ("FAIL: adult df number mismatch!")
|
cat ("FAIL: adult df number mismatch!")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#==============
|
||||||
|
# FLU positive: adult patients
|
||||||
|
#==============
|
||||||
|
# extract the flu positive population
|
||||||
|
fp_adults = adult_df[adult_df$flustat == 1,]
|
||||||
|
|
||||||
#============
|
#============
|
||||||
# hc
|
# hc
|
||||||
#============
|
#============
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue