#' Replace NA with zero
#' @param data data.frame
#'
replace_na_with_zero <- function(data) {
num_col <- sapply(data, is.numeric)
from_na_to_zero <- function(x) {
ifelse(is.na(x), 0, x)
}
data[, num_col] <- sapply(data[, num_col], from_na_to_zero)
return(data)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.