我试图在R中的字符串中获取开括号的数量.我正在使用包中的str_count函数stringr
str_count
stringr
s<- "(hi),(bye),(hi)" str_count(s,"(")
stri_count_regex出错(string,pattern,opts_regex = attr(pattern,:`正则表达式模式中的嵌套括号错误.(U_REGEX_MISMATCHED_PAREN)
我希望这个例子得到3
r stringr
r ×1
stringr ×1