punctuate | R Documentation |
Keeps the punctuations you want and removes the punctuations you don't
punctuate(
text,
allowPunctuations = c("-", "?", "'", "\"", ";", ",", ".", "!")
)
text |
Character vector or list. Text in a vector or list data format |
allowPunctuations |
Character vector. Punctuations that should be allowed in the text. Defaults to common punctuations in English text |
Coarsely removes punctuations from text. Keeps general punctuations that are used in most English language text. Apostrophes are much trickier. For example, not allowing "'" will remove apostrophes from contractions like "can't" becoming "cant"
Returns text with only the allowed punctuations
Alexander P. Christensen <alexpaulchristensen@gmail.com>
# Load data
data(neo_ipip_extraversion)
# Example text
text <- neo_ipip_extraversion$friendliness
# Keep only periods
punctuate(text, allowPunctuations = c("."))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.