使用sep括号时出现tidyr单独错误
我无法使用括号作为分隔字符分隔列:使用sep括号时出现tidyr单独错误,r,tidyr,R,Tidyr,我无法使用括号作为分隔字符分隔列: d = data.frame(a = c('af(dsf', 'sdf (asdf', 'sdf(df')) d %>% separate(a, c('a','b'), sep = '(') stringi::stri_split_regex(值,sep,n_max)中出错:错误 regexp模式中的嵌套括号。(U_REGEX_MISMATCHED_PAREN) 有虫子吗?提前感谢。我们不需要在此处明确指定sep,因为它会自动检测 separate(d
d = data.frame(a = c('af(dsf', 'sdf (asdf', 'sdf(df'))
d %>% separate(a, c('a','b'), sep = '(')
stringi::stri_split_regex(值,sep,n_max)中出错:错误
regexp模式中的嵌套括号。(U_REGEX_MISMATCHED_PAREN)
有虫子吗?提前感谢。我们不需要在此处明确指定
sep
,因为它会自动检测
separate(d, a, c("a", "b"))
# a b
#1 af dsf
#2 sdf asdf
#3 sdf df
如果需要指定,可以像注释中那样转义(\\(
),或者将其放在方括号中
separate(d, a, c("a", "b"), sep="[(]")
# a b
#1 af dsf
#2 sdf asdf
#3 sdf df
使用
sep='\\('
insteadThank。!