I do text mining in Arabic language ,and I wrote this code and it will check on number of character, and if it greater than 5 will do gsub function
but it gives me error and I am sure that because of gsub function but i do not know how to deal with it.
here is my code
try$text<-sapply(strsplit(try$text, ''), function(i){i[nchar(i) > 5] <- gsub('(?<=\\p{L})\\x{064A}\\x{0646}$', '', i[nchar(i) 5];perl = TRUE);paste(i,collapse = ' ')})
here is the error
**Error in gsub("(?<=\\p{L})\\x{064A}\\x{0646}$", "", i[nchar(i) > 5], perl = TRUE) :
invalid regular expression '(?<=\p{L})\x{064A}\x{0646}$'
In addition: Warning message:
In gsub("(?<=\\p{L})\\x{064A}\\x{0646}$", "", i[nchar(i) > 5], perl = TRUE) :
Show Traceback
Rerun with Debug
Error in gsub("(?<=\\p{L})\\x{064A}\\x{0646}$", "", i[nchar(i) > 5], perl = TRUE) :
invalid regular expression '(?<=\p{L})\x{064A}\x{0646}$' **
thank you