#' Remove all \code{@mentions} from the beginning of strings.
#'
#' \code{str_remove_reply_mentions} - Remove all \code{@mentions} from the beginning of strings. This can be useful for cleaning tweets because the texts of replies start with the \code{screen_names} of all users further down the reply tree.
#'
#' @param .str ...
#' @return \code{str_remove_reply_mentions} - returns a ...
#' @rdname str_remove_reply_mentions
#' @export
#' @examples
#' ## str_remove_reply_mentions EXAMPLE:
#'
#' str_remove_reply_mentions(c(
#' "@test test!",
#' "@test @test test test!"
#' ))
str_remove_reply_mentions <- function(
.str
){
.str |>
stringi::stri_replace_all_regex(
pattern=str_c("(?:", pattern_reg_screen_name, " )+"),
replacement=""
) |>
rlang::set_names(names(.str))
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.