如何将14个数字组合的所有组合列表分为两个单独的组?
因此,我正在尝试创建所有14个数字组合的列表,这些列表已分为两个单独的组。例如,此列表的开头看起来像:
X组 | Y |
---|---|
1 | 2、3、4、5、6、7、8、9、10、11、11、12、13、14 |
1、2 | 3、4、5 ,6、7、8、9、10、11、12、13、14 1、2、3 |
之 | 4、5、6、7、8、9、10、11、11、12、13、14 |
类的。当分为两组时,此列表将包括16384个可能的组合。 (2^14)关于如何在R中执行此操作的任何想法?
So I am trying to create a list of all combinations of 14 numbers that have been split into two separate groups. For example, the beginning of this list may look like:
Group X | Group Y |
---|---|
1 | 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14 |
1, 2 | 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14 |
1, 2, 3 | 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14 |
And so forth. This list would consist of 16384 possible combinations of these 14 numbers when split into two groups. (2^14) Any ideas on how to do this in R?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
您可以尝试(对于
2^3
案例)You may try (for
2^3
cases)我相信此代码可以完成与您要求的有关的事情。结果通过相应的行存储在矩阵“ group1”和“ group2”的非零条目中,因此您可能需要更改代码,以便以对您的目的有用的形式呈现结果。
输出从R控制台返回时显示出来;末尾的截断数据表说明了输出的形式。
I believe that this code accomplishes something close to what you are requesting. The results are stored in the non-zero entries of the matrices "group1" and "group2" by corresponding row, so you may need to alter the code in order to render the results in a form that is useful for your purposes.
The output is shown as it was returned from the R console; the truncated data tables at the end illustrate the form of the output.
我们可以尝试
combn
,如下所示,我们将看到
We can try
combn
like belowand we will see