changed df to adults df to extract relevant info
This commit is contained in:
parent
9e5b202f5d
commit
bbdd2d12e5
5 changed files with 78 additions and 1007 deletions
26
read_data.R
26
read_data.R
|
@ -26,9 +26,16 @@ all_df <- read.csv("/home/backup/MOSAIC/MEDIATOR_Data/master_file/Mosaic_master_
|
|||
, fileEncoding = 'latin1')
|
||||
|
||||
# meta data columns
|
||||
meta_data_cols = c("mosaic", "gender", "age", "adult", "flustat", "type"
|
||||
, "obesity", "obese2", "height", "height_unit", "weight"
|
||||
, "weight_unit", "visual_est_bmi", "bmi_rating")
|
||||
meta_data_cols = c("mosaic", "gender", "age"
|
||||
, "adult"
|
||||
, "flustat", "type"
|
||||
, "obesity"
|
||||
, "obese2"
|
||||
, "height", "height_unit"
|
||||
, "weight", "weight_unit"
|
||||
, "ia_height_ftin", "ia_height_m", "ia_weight"
|
||||
, "visual_est_bmi", "bmi_rating"
|
||||
)
|
||||
|
||||
# check if these columns to select are present in the data
|
||||
meta_data_cols%in%colnames(all_df)
|
||||
|
@ -36,6 +43,19 @@ all(meta_data_cols%in%colnames(all_df))
|
|||
|
||||
metadata_all = all_df[, meta_data_cols]
|
||||
|
||||
|
||||
#==============
|
||||
# adult patients
|
||||
#==============
|
||||
|
||||
adult_df = all_df[all_df$age>=18,]
|
||||
|
||||
if (table(adult_df$adult == 1)[[1]] == nrow(adult_df) ){
|
||||
cat ("PASS: adult df extracted successfully")
|
||||
} else{
|
||||
cat ("FAIL: adult df number mismatch!")
|
||||
}
|
||||
|
||||
#============
|
||||
# hc
|
||||
#============
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue