I cannot separate columns using parenthesis as separation character:
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)
There is a bug? Thanks in advance.
We don't need to specify the sep explicitly here as it will automatically detects
separate(d, a, c("a", "b"))
# a b
#1 af dsf
#2 sdf asdf
#3 sdf df
If needed to specify, either escape (\\() as in the comments or place it in a square bracket
separate(d, a, c("a", "b"), sep="[(]")
# a b
#1 af dsf
#2 sdf asdf
#3 sdf df
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With