I have seen many solutions to the problem of exploding a comma-separated
string column (e.g., this nice SO answer).
However, how can I go from this data frame
df <- data.frame(x = 1, y = "A,B,C,D")
to this one:
tb <- data.frame(x = c(1,1,1), y = c("A,B", "B,C", "C,D"))?
The goal is to split the string column by pairs of consecutive letters. It is easy to solve this problem with non-vectorized R code. The main problem for me is that the table is too big to fit in memory, so a solution with sparklyr would be great.
Thanks, in advance!