I have a data frame and some columns have NA values.
NA
How do I replace these NA values with zeroes?
dplyr example:
library(dplyr) df1 <- df1 %>% mutate(myCol1 = if_else(is.na(myCol1), 0, myCol1))
Note: This works per selected column, if we need to do this for all column, see @reidjax's answer using mutate_each.