My file is like this-
Pcol Mcol
P1 M1,M2,M5,M6
P2 M1,M2,M3,M5
P3 M4,M5,M7,M6
I want to find the combination of Mcol elements along with Pcol.
Expected output-
Pcol Mcol
P1 M1,M2
P2 M1,M2
P1 M1,M5
P2 M1,M5
P1 M1,M6
P1 M2,M5
P2 M2,M5
P1 M2,M6
P1 M5,M6
P3 M5,M6
P2 M1,M3
P2 M2,M3
P3 M4,M5
P3 M4,M7
P3 M4,M6
P3 M7,M6
I have tried this-
x <- read.csv("file.csv" ,header = TRUE, stringsAsFactors = FALSE)
xx <- do.call(rbind.data.frame,
lapply(x$Gcol, function(i){