Tenho o seguinte 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')
)
Preciso substituir todos os ")" e "(" por espaços em branco. Tentei tudo que que é possível e imaginável. Vou colocar a seguir cada uma das tentativas com os respectivos erros:
Primeira tentativa
> 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', " ")
Segunda tentativa
> cadastros2<-cadastros%>%
> + str_replace_all(cadastros,"6", replacement = "[[:blank:]]") Error in str_replace_all(., cadastros, "6", replacement =
> "[[:blank:]]") : unused argument ("6")
Terceira tentativa
> 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
Quarta tentativa
> 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
Qualquer ajuda é bem vinda.