Created
July 31, 2018 14:39
-
-
Save gabrielburcea/8f5915c473fd5d7a314a4bf0eb4a2b61 to your computer and use it in GitHub Desktop.
Function_4hrs_perf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
four_hrs_perf_data_clean <- function(df) { | |
colname_ct <- function(df, colname){ | |
df[,colname] = as.POSIXct(df[,colname]) | |
df | |
} | |
df %>% | |
dplyr::select("PAT_CODE", "START_DATETIME", "END_DATETIME", "WARD_CODE", "episode.order", "spell.number") %>% | |
dplyr::rename(patient_id = PAT_CODE, admission_time = START_DATETIME, discharge_time = END_DATETIME, ward = WARD_CODE, episode_number = episode.order, spell_number = spell.number) %>% | |
colname_ct("admission_time") %>% | |
colname_ct("discharge_time") %>% | |
dplyr::filter(ward == "A&E") %>% | |
dplyr::filter(admission_time >= "2015-01-01 00:00:00", admission_time <= "2015-07-27 23:59:00", discharge_time >= "2015-01-01 00:00:00" , discharge_time <= "2015-07-27 23:59:00") | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment