I have a data frame and some columns have NA values.
NA
How do I replace these NA values with zeroes?
For a single vector:
x <- c(1,2,NA,4,5) x[is.na(x)] <- 0
For a data.frame, make a function out of the above, then apply it to the columns.
apply
Please provide a reproducible example next time as detailed here:
How to make a great R reproducible example?