Reputation: 145
I am trying to remove the special character from the following string with the help of following code , but not getting the result :
library(tm)
v <- "rt shibxwarrior hodl trust processsome great things horizon folks shib \n\nshib shiba shibainu shibar…"
t <- "[\n~@!#$%&*…[]'=;]"
removespl_character <- function(x)gsub('t','',x)
cleanset_t <- tm_map(v,removespl_character)
Please help me on this.. thanks a lot
Upvotes: 0
Views: 204
Reputation: 351
I've changed the pattern to this :
v <- "rt ~@!#$%&*…[]'=; shibxwarrior[] hodl trust processsome great things horizon folks shib \n\nshib shiba shibainu shibar…"
t <- "[~@\\!#\n$%&\\*…\\'=;]|\\]|\\["
v
gsub(pattern = t, replacement = "", x = v)
I copied your input :
v <- "rt shibxwarrior hodl trust processsome great things horizon folks shib \n\nshib shiba shibainu shibar…"
t <- "[~@\\!#\n$%&\\*…\\'=;]|\\]|\\["
v
gsub(pattern = t, replacement = "", x = v)
Upvotes: 1