#' REPLACE NAs BY ANOTHER VALUE IN A DATA.TABLE
#'
#' @param x is a `data.table`
#' @param val is the value to replace NAs for. By default, it looks
#' for and replaces 0s
#'
#' @export
#'
#' @return a `data.table`
#'
#' @importFrom data.table data.table
replaceNAs <- function(x, val = 0) {
x[is.na(x)] <- val
x
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.