#' @title Remove Rows with NA Values
#'
#' @description Given \code{table} and its profile \code{table_profile}
#' generated by \code{\link{generate_table_profile}}, when the function is
#' called, then rows containing missing values are dropped.
#'
#' @param table (`data.frame`) The table to apply the operation.
#' @param table_profile (`data.frame`) The table profile which was created by
#' \code{\link{generate_table_profile}}.
#'
#' @return (`data.frame`) A nested list with the table attributes.
#'
#' @export
#'
#' @seealso \link[tidyr]{drop_na}
#' @family TableCleaner high-level functions
#'
#' @examples
#' \dontrun{
#' mtcars_prfile <- generate_table_profile(mtcars)
#' mtcars_tidy <- drop_rows_with_na(mtcars, mtcars_prfile)
#' }
#'
drop_rows_with_na <- function(table, table_profile){
selected_vars <- table_profile %>% rlist::list.filter(FALSE %in% na) %>% names()
table %>% tidyr::drop_na(selected_vars)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.