使用 sep 括号时出现 tidyr separate 错误
tidyr separate error when use sep parenthesis
我无法使用括号作为分隔符来分隔列:
d = data.frame(a = c('af(dsf', 'sdf (asdf', 'sdf(df'))
d %>% separate(a, c('a','b'), sep = '(')
Error in stringi::stri_split_regex(value, sep, n_max) : Incorrectly
nested parentheses in regexp pattern. (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
我无法使用括号作为分隔符来分隔列:
d = data.frame(a = c('af(dsf', 'sdf (asdf', 'sdf(df'))
d %>% separate(a, c('a','b'), sep = '(')
Error in stringi::stri_split_regex(value, sep, n_max) : Incorrectly nested parentheses in regexp pattern. (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