[R] Data aggregation

Paolo Letizia paolo.letizia at gmail.com
Mon Jun 20 23:34:19 CEST 2016


Dear All:
I have a data frame with 3 columns: "Regime", "Industry", and "Cost".
I want to sum the value of "Cost" for each industry and "Regime".
Example:

The data frame is:
Regime, Industry, Cost
10, 01, 370
11, 01, 400
10, 02, 200
10, 01, 500
11, 02, 60
10, 02, 30

I want the following output:
01, 10, 870
01, 11, 400
02, 10, 230
02, 11, 600

Can you please help me on this? Paolo

	[[alternative HTML version deleted]]



More information about the R-help mailing list