I am attempting to aggregate or group a data frame base on a common field. Beyond wanting to sum some demographic numbers with the aggregation, I am also trying to aggregate string fields. Within some of the string fields (ie, County, State, Countycode, etc) they are always the same amongst those with the same common field, but some of the string fields (ie, Congressional district, Senate House, et) are unique amongst those with the same common field.
The objective is to combine fields with the same value in the COMMON_FIELD. For the string fields that are unique within their common field group, I need R to select the values from one of the common field groups. It doesn't matter from which row it acquires the values as long as it is a row that shares the common field value.
Code Sample
IDENTIFICATION | COUNTY | TOTAL_POPULATION | YOUTH_POPULATION | COMMON_FIELD
Oakland-013 | Alameda | 3000 | 1000 | A1-3
Oakland-012 | Alameda | 5000 | 2000 | A1-3
Desired Results:
IDENTIFICATION | COUNTY | TOTAL_POPULATION | YOUTH_POPULATION | COMMON_FIELD
Oakland-013 | Alameda | 8000 | 3000 | A1-3
Thus, although the identification field will be unique amongst groups with the same common field, I would like R to pick one from the groups in the common field and it doesn't matter which it picks.