I have a character variable that I would like to split into 2 variables based on a \"-\" delimiter, however, I would only like to split based on the last delimiter as there
You can also use a negative lookahead:
df <- tibble(input = c("foo - bar", "hey-now-man", "say-now-girl", "fine-now"))
df %>%
separate(input, into = c("output1", "output2"), sep = "\\-(?!.*-)", remove = FALSE)
Refs:
[1] https://frightanic.com/software-development/regex-match-last-occurrence/
[2] https://www.regular-expressions.info/lookaround.html