I wonder if there is some secret argument that would allow to apply separate
from the end of the line? Some magic_argument
?
The desired output would be as follows:
library(dplyr)
df <- data.frame(x = c(NA, "a.b.b", "a.b.d", "b.c"))
df %>% separate(x, c("A", "B"), magic_argument = TRUE)
#> A B
#> 1 <NA> <NA>
#> 2 a.b b
#> 3 a.b d
#> 4 b c