Error in stri_detect_regex in R

前端 未结 1 373
后悔当初
后悔当初 2020-12-11 21:28

I am receiving this error

Error in stri_detect_regex(string, pattern, opts_regex = opts(pattern)) : Incorrectly nested parentheses in regexp patt

相关标签:
1条回答
  • 2020-12-11 21:54

    Since you are using fixed strings, not regular expressions, you need to tell the regex engine to use the patterns as plain, literal text. You can use it like this:

    str_detect(final_RN$named_RN, fixed(x))
                                  ^^^^^^^^
    

    See "Fixed matches":

    fixed(x) only matches the exact sequence of bytes specified by x. This is a very limited “pattern”, but the restriction can make matching much faster.

    You might also consider coll(x) in case you want to use human-language collation rules while performing a case insensitive search.

    0 讨论(0)
提交回复
热议问题