R/addin.R

Defines functions offensive_addin

Documented in offensive_addin

#' Checks for offensive words in selection
#'
#' Call this function as an addin to check for offensive words in selection.
#' Example is shown at \url{https://github.com/EmilHvitfeldt/offensiveR}.
#'
#' @export
offensive_addin <- function() {
  context <- rstudioapi::getActiveDocumentContext()

  # Set the default data to use based on the selection.
  text <- context$selection[[1]]$text

  offensive_check_string(text)
}
EmilHvitfeldt/offensiveR documentation built on May 6, 2019, 12:23 p.m.