# Computing the age structure using harmonized data

**URL:** <https://forum.ipums.org/t/computing-the-age-structure-using-harmonized-data/5623>\
**Category:** INTERNATIONAL\
**Created:** [January 22, 2024, 9:56pm UTC](https://forum.ipums.org/t/computing-the-age-structure-using-harmonized-data/5623 "2024-01-22T21:56:55Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Emanuel\_Agu](https://avatars.discourse-cdn.com/v4/letter/e/43a26b/32.png) [@Emanuel\_Agu](https://forum.ipums.org/u/Emanuel_Agu)\
**Post date:** [January 22, 2024, 9:56pm UTC](https://forum.ipums.org/t/computing-the-age-structure-using-harmonized-data/5623/1 "2024-01-22T21:56:56Z")

</div>

Hi everyone,

I’m interested in computing the age structure by age and sex (and year) at the geo1 and geo2 levels (when possible) using harmonized data. Then, I would like to use that data to compute demographic indicators that will be plotted onto the (harmonized) shapefile. Ideally, I’ll make all this for any country in the IPUMS International collection. Do you find this doable in R?

Thank you,

---

<div class="post-metadata">

**Author:** ![Ivan\_Strahof](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.ipums.org/ivan_strahof/32/626_2.png) [@Ivan\_Strahof](https://forum.ipums.org/u/Ivan_Strahof)\
**Post date:** [January 31, 2024, 9:20pm UTC](https://forum.ipums.org/t/computing-the-age-structure-using-harmonized-data/5623/2 "2024-01-31T21:20:00Z")

</div>

Hi Emanuel,

This definitely sounds doable in R. Once you’ve computed the age structure by geography and your demographic indicators, you can merge this data onto the shapefiles [provided through IPUMS International](https://international.ipums.org/international/gis.shtml) using the [COUNTRY](https://international.ipums.org/international-action/variables/COUNTRY#codes_section), [GEOLEV1](https://international.ipums.org/international-action/variables/GEOLEV1), and [GEOLEV2](https://international.ipums.org/international-action/variables/GEOLEV2) codes as linking keys. The .zip file you download and extract includes a .shp shapefile that you can merge with these indicators in your dataframe using [the sf package](https://r-spatial.github.io/sf/) (see [this StackExchange post](https://gis.stackexchange.com/questions/379918/merging-shapefile-with-dataframe-and-plotting-using-r) for an example of how to do this).
