I was wondering if there was any way in R to split strings from multiple columns into multiple rows respectively. For example:
Split something from: V1 V2 V3
1 A,B,C C,D,F
2 X,Y,Z V,U,
Into V1 V2 V3
1 A C
1 B D
1 C F
2 X V
.... 2 Z NA
and so on. I was able to it for the first column, but the second column just prints duplicates of what is in the first column. I am using R so I can use either R syntax of SQLite syntax. Thank you!
Here is what I have so far:
split<- strsplit(as.character(Start), as.character(End), split= ";")
split1<-data.frame(id = rep(dataset$id, sapply(split, length)), End = unlist(split), End=unlist(split))