How do I remove digits and special characters from a string using grep1()
{stringr} is easier
{stringr}
library(stringr) the_pattern <- "[:digit:]|[:punct:]" the_string <- "6abc#" the_string #> [1] "6abc#" str_remove_all(the_string,the_pattern) #> [1] "abc"
This topic was automatically closed 7 days after the last reply. New replies are no longer allowed. If you have a query related to it or one of the replies, start a new topic and refer back with a link.