mgsub_censor | R Documentation |
mgsub_censor
- A safe, simultaneous, multiple global string censoring
(replace matches with a censoring character like '*')
mgsub_censor( string, pattern, censor = "*", split = any(nchar(censor) > 1), seed = NULL, ... )
string |
a character vector to censor |
pattern |
regular expressions used to identify where to censor |
censor |
character to use in censoring - see details |
split |
if a multicharacter censor pattern is provided, should it be split to preserve original string length |
seed |
optional parameter to fix sampling of multicharacter censors |
... |
arguments to pass to |
When censor is provided as a >1 length vector or as a multicharacter string with split = TRUE, it will be sampled to return random censoring patterns. This can be helpful if you want to create cartoonish swear censoring. If needed, the randomization can be controlled with the seed argument.
Censored string.
mgsub_censor("Flowers for a friend", pattern=c("low"), censor="*")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.