#' Filter loudly
#' @description Filter with message of how many rows have been filtered
#' @param ... Pass through to \code{dplyr::filter()}
#' @return Filtered data with message of how many rows have been filtered
#' @examples
#' mtcars %>% filter_loudly(mpg == 6)
#' @export
filter_loudly <- function(.data, ...){
in_rows <- nrow(.data)
out <- filter(.data, ...)
out_rows <- nrow(out)
message("Filtered out ", in_rows - out_rows, " rows.")
out
}
#' Not In: Inverse Value Matching
#' @description Returns a logical vector indicating if there is NOT a match for the LHS vector anywhere in the RHS vector. Opposide of \code{\%in\%}.
#' @usage x %ni% y
#' @param x vector or NULL: the values to check for non-match
#' @param y vector or NULL: the values to be matched against
#' @return A logical vector, indicating if there was no match for each element of x. Values are TRUE or FALSE and never NA
#' @rdname ni
#' @export
"%ni%" <- Negate("%in%")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.