Skip to contents

Remove punctuation and/or accent from a string.

Usage

str_clean(string, remove_accent = TRUE, remove_punct = TRUE, sub_punct = "")

Arguments

string

A character vector

remove_accent

A boolean value, if TRUE the function will remove accent symbols from the string (default = TRUE)

remove_punct

A boolean value, if TRUE the function will remove punctuation symbols from the string (default = TRUE)

sub_punct

A character single value (default = ''), that will be replacement for the punctuation symbols

Value

A character vector.

Examples


string <- "a..;éâ...íõ"

#remove only punctuation
str_clean(string,remove_accent = FALSE,remove_punct = TRUE)
#> [1] "aéâíõ"

#remove only accent
str_clean(string,remove_accent = TRUE,remove_punct = FALSE)
#> [1] "a..;ea...io"

#remove both
str_clean(string)
#> [1] "aeaio"