I want to make my first glm but in some of the variables I use are NA's. I can't find the right information about how to clean these columns so it can be used in glm.
Is it possible to handle this at once when making a model in the glm function? Or is it necessary to do it in advance for every column.
And what is the best way for doing this without removing entire rows in the dataframe? By using
na.omit() it removes all incomplete cases of a data object but I only want to ignore these NA's when modelling.
I found this one usefull for integer variables
df %>% mutate_all(~ifelse(is.na(.x), mean(.x, na.rm = TRUE), .x))
But what about numeric variables like 1 = male and 2 = female?
I think it is really a beginners issue, not that exciting for most of you I think.. But hopefully someone can help me.
Thanks in advance!