
[英]How do I multiply grouped values inside a column of data.table and return the data.table only with the result rows
如何通过从另一列分组来乘以一列内的值。 假设我有: 我想将值的元素彼此相乘,但只将属于同一组的元素相乘,因此会返回。 我用cumprod试过 但随后返回dt=data.table(group=c(1,1,2,2), value=c(2,6,4,20))我不知道如何删除我不删除的行需要:那些具有 va ...