KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I have a data frame containing 7 different dilutions that I want to assign into 3 different bins in all possible combinations for later use in lpSolve . I can generate all 2187 possible combinations using: expand.grid(1:3, 1:3, 1:3, 1:3, 1:3, 1:3, 1:3) However, since the actual bin number is not important (but position is), the following entries are all considered identical in this context: c(1, 1, 2, 2, 2, 3, 3) c(2, 2, 3, 3, 3, 1, 1) c(3, 3, 1, 1, 1, 2, 2) c(3, 3, 2, 2, 2, 1, 1) c(1, 1, 3, 3, 3, 2, 2) ... How do I generate only unique "patterns", either by filtering expand.grid output or by using another (custom) function. For example, the lengths output from rle of all of the above vectors would be 2 3 2 , but that would also be the case for c(1, 1, 2, 2, 2, 1, 1) which should be not considered identical to the above. Any fast way around this? I do not need to go higher than 5 bins and 8 dilutions.
Tags (comma-separated)
Save Edits
Cancel