Efficient conditional summing by multiple conditions in R
问题 I'm struggling with finding an efficient solution for the following problem: I have a large manipulated data frame with around 8 columns and 80000 rows that generally includes multiple data types. I want to create a new data frame that includes the sum of one column if conditions from the large data frame are met. Imagine the head of the original data frame looks like this. The column $years.raw indicates that the company measured data for x years. > cbind(company.raw,years.raw,source,amount