More trivial solution i used :
library(data.table) your_df[, lapply(.SD, function(x){ ifelse(is.na(x), 0, x) }), .SDcols = is.numeric]