Remove all punctuation and special characters from the input tweets data

remove_punct(tweets, skip = NULL)

Arguments

tweets

A vector of tweets

skip

Vector of charcters or NULL. The set of characters that do not have to be removed. Default is NULL. If NULL, all characters except alphabets, numbers and space would be removed.

Value

Vector of tweets without special characters

Examples

tweets <- c(
   "Make America Great Again! @DonaldTrump",
    "It's rocket-science tier investment~~ #LoveElonMusk"
)
remove_punct(tweets)
#> [1] "Make America Great Again DonaldTrump"          
#> [2] "Its rocketscience tier investment LoveElonMusk"
remove_punct(tweets, skip = c("'", "@", "#", "-"))
#> [1] "Make America Great Again @DonaldTrump"            
#> [2] "It's rocket-science tier investment #LoveElonMusk"