Remove/Replace/Extract Emoticons

Usage

rm_emoticon(text.var, trim = !extract, clean = TRUE, pattern = "@rm_emoticon", replacement = "", extract = FALSE, dictionary = getOption("regex.library"), ...)

Arguments

text.var
The text variable.
trim
logical. If TRUE removes leading and trailing white spaces.
clean
trim logical. If TRUE extra white spaces and escaped character will be removed.
pattern
A character string containing a regular expression (or character string for fixed = TRUE) to be matched in the given character vector. Default, @rm_emoticon uses the rm_emoticon regex from the regular expression dictionary from the dictionary argument.
replacement
Replacement for matched pattern.
extract
logical. If TRUE the emoticons are extracted into a list of vectors.
dictionary
A dictionary of canned regular expressions to search within if pattern begins with "@rm_".
...
Other arguments passed to gsub.

Value

Returns a character string with emoticons removed.

Description

Remove/replace/extract common emoticons from a string.

Examples

x <- c("are :-)) it 8-D he XD on =-D they :D of :-) is :> for :o) that :-/", "as :-D I xD with :^) a =D to =) the 8D and :3 in =3 you 8) his B^D was") rm_emoticon(x)
[1] "are it he on they of is for that" "as I with a to the and in you his was"
rm_emoticon(x, extract=TRUE)
[[1]] [1] ":-))" "8-D" "XD" "=-D" ":D" ":-)" ":>" ":o)" ":-/" [[2]] [1] ":-D" "xD" ":^)" "=D" "=)" "8D" ":3" "=3" "8)" "B^D"