[英]How to add a column to an R data.table that contains all the possible combinations by group of another column
[我有一张包含单核苷酸频率的表格,我想进行所有可能的组合(AA、AT、AG、AC……并将它们的频率(列频率)乘以“物种”分组以添加它作为包含二核苷酸的其他表的新列。带有二核苷酸的表应该有一个“预期频率”列,按物种分类,其中包含按物种分类的组合单核苷酸频率的乘积] 2
Some minimal data to replicate your desired results would be beneficial for us.一些最小的数据来复制您想要的结果对我们来说是有益的。
Take a look at permutations()
from gtools and mutate()
from the dplyr package.查看 gtools 中的permutations()
和 dplyr 包中的mutate()
。 These might help.这些可能会有所帮助。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.