I have a column indicating the outcome of patients, however it has many NAs. This column has multiple 'character' options (e.g. 'Alive, discharged with supplemental oxygen', 'Deceased', etc.), however I use an index to dichotomize it so those variables largely don't matter. My issue is that I need to change the NAs into one of the variables in this column ('Outcome'). It can be any of the values except for 'Deceased' including a new one if that works. I'm trying to apply this change across the entire data set as I will then use the new dichotomized across many calculations.
cleanset <- Data1 %>%
drop_na(BMI) %>%
filter(!complete.cases(.))
The above represents the first of the code I run to clean up the set. I then would like to follow it with the mutation/transformation of the NAs for the 'Outcome' variable.
mutate(cleanset$Outcome = replace_na(cleanset$Outcome, "Alive, discharged with supplemental oxygen"))
The above is my failed attempt at achieving this, so I would appreciate any input on how I can successfully mutate the NAs for this variable to give them a specific value.