Created
August 16, 2018 16:30
-
-
Save gabrielburcea/3ad0d1c48d397f55ff8b59f5d715d679 to your computer and use it in GitHub Desktop.
Replace NA values with a factor level, use multiple conditions with filter function
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
df_subset <- df %>% | |
filter(spell.type == "Emergency" & sex != "Not Specified", | |
end_datetime >= "2012-09-29" & end_datetime <= "2013-09-29") %>% | |
mutate(as.Date(end_datetime)) %>% | |
replace_na(list(patient.class = "Not_Admitted")) %>% | |
select(pat_code, end_datetime, age_band, sex, patient.class, spell.type) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment