Get all possible string sequences where each element comes from different set in R
问题 Assume I have 4 vectors of character elements: s1 <- c("o", "ó") s2 <- c("c", "ć") s3 <- c("o", "ó") s4 <- c("z", "ź", "ż") I want to build 4-element vectors that are all possible combinations of elements from s1 , s2 , s3 , s4 in a way that in one of a result vectors 1-st, -2nd, 3-rd and 4-th element comes from s1 , s2 , s3 , s4 , respectively. For example, I would like to get the following result vectors: [1] "o", "c", "o", "z" [1] "ó", "c", "o", "z" [1] "o", "ć", "o", "z" ... [ My general