[R] Data aggregation

2016-06-20 Thread Paolo Letizia
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:

[R] Importing data from a text file with no separator

2016-06-08 Thread Paolo Letizia
I have row data in a text file, where each row consists of 22 numerical characters. Each row consists of three different column but there is no separator. Specifically, the first two characters of the raw represent the first column of data, the subsequent 8 characters represent the second column