I am receiving this error
Error in stri_detect_regex(string, pattern, opts_regex = opts(pattern)) : Incorrectly nested parentheses in regexp patt
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 byx
. 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.