, rm_nchar_words
qdapRegex, @hwnd (SO regex guuru extraordinaire). 1-2 , 1-3 :
str<- c("hello RP have a nice day")
library(qdapTools)
rm_nchar_words(str, "1,2")
## [1] "hello have nice day"
rm_nchar_words(str, "1,3")
## [1] "hello have nice"
As qdapRegex , the following regular expression should be studied here, where the function S
places 1,2
the quantifier in braces:
S("@rm_nchar_words", "1,2")
## "(?<![\\w'])(?:'?\\w'?){1,2}(?![\\w'])"
source
share