Hi @GabrielYan , if the data is dtb, Remmember put a reproducible example for better understand all the community.
dtb
Try with this:
library(dplyr) dtb<- dtb %>% replace(is.na(.), 0)