My file is like this-
Pcol Mcol
P1 M1,M2,M5,M6,M1,M2,M1.M5
P2 M1,M2,M3,M5,M1,M2,M1,M3
P3 M4,M5,M7,M6,M5,M7,M4,M7
I want to find all the combination of Mcol elements and find these combinatinatons are present in how many rows.
Expected output-
Mcol freq
M1,M2 2
M1,M5 2
M1,M6 1
M2,M5 2
M2,M6 1
M5,M6 2
M1,M3 1
M2,M3 1
M4,M5 1
M4,M7 1
M4,M6 1
M7,M6 1
I have tried this-
x <- read.csv("file.csv" ,header = TRUE, stringsAsFactors = FALSE)