我怎样才能在 R 中完成这项工作?
str_split("U.S. (California, San Luis Obispo County)",pattern=' (')
gregexpr("(", "US (California, San Luis Obispo County)", fixed = FALSE, : invalid regular expression '(', reason 'Missing ')'' 中的错误
gregexpr("(", "U.S. (California, San Luis Obispo County)")
gregexpr("(", "US (California, San Luis Obispo County)") 中的错误:无效的正则表达式 '(',原因 'Missing ')''
gregexpr("(", "U.S. (California, San Luis Obispo County)",perl=T)
gregexpr("(", "US (California, San Luis Obispo County)", perl = T) 中的错误:无效的正则表达式 '('
此外,警告信息:
In gregexpr("(", "U.S. (California, San Luis Obispo County)", perl = T) :
PCRE pattern compilation error
'missing )'
at ''