#' Return the relative frequency of missing values
#'
#' @param vec A vector
#' @param dd A data.frame
#'
#' @return relative frequency of NA
#' @export
na.freq <- function(vec) {
length(which(is.na(vec))) / length(vec)
}
#' @describeIn na.freq alias of `na.freq`
na_freq <- na.freq
#' @describeIn na.freq Function that returns the number frequency of missing values for each column
col.missing <- function(dd){
sapply(dd, na.freq)
}
#' @describeIn na.freq Function that returns the number frequency of missing values for each row
row.missing <- function(dd){
apply(dd,1, na.freq)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.