7
I got the following data.frame
:
cadastros <- data.frame(
email = c('[email protected]', '[email protected]', '[email protected]', '[email protected]'),
telefone = c('(61)99831-9482', '32 8976 2913', '62-9661-1234', '15-40192.5812')
)
I need to replace all ")" and "(" with blank spaces. I have tried everything that is possible and imaginable. I will put next each of the attempts with the respective mistakes:
First attempt
> library(stringr)
> str_replace_all(string = cadastros,
+ pattern = ")",
+ replacement = "[[:blank:]]")
Error in stri_replace_all_regex(string, pattern, fix_replacement(replacement), :
Incorrectly nested parentheses in regexp pattern. (U_REGEX_MISMATCHED_PAREN)
In addition: Warning message:
In stri_replace_all_regex(string, pattern, fix_replacement(replacement), :
argument is not an atomic vector; coercingstr_replace(cadastros, 'c', " ")
Second attempt
> cadastros2<-cadastros%>%
> + str_replace_all(cadastros,"6", replacement = "[[:blank:]]") Error in str_replace_all(., cadastros, "6", replacement =
> "[[:blank:]]") : unused argument ("6")
Third attempt
> str_replace_all(cadastros, pattern = ")",replacement = "[[:blank:]]")
Error in stri_replace_all_regex(string, pattern, fix_replacement(replacement), :
Incorrectly nested parentheses in regexp pattern. (U_REGEX_MISMATCHED_PAREN)
In addition: Warning message:
In stri_replace_all_regex(string, pattern, fix_replacement(replacement), :
argument is not an atomic vector; coercing
Fourth attempt
> str_replace_all(cadastros, pattern = ")","[[:blank:]]")
Error in stri_replace_all_regex(string, pattern, fix_replacement(replacement), :
Incorrectly nested parentheses in regexp pattern. (U_REGEX_MISMATCHED_PAREN)
In addition: Warning message:
In stri_replace_all_regex(string, pattern, fix_replacement(replacement), :
argument is not an atomic vector; coercing
Any help is welcome.