I'm looking for monthly, mean temperature data on the country-level since 1900 (or at least 1950) for which the temperature is weighted according to population density.
The common database for the spatial temperature is by Willmott and Matsuura here: http://climate.geog.udel.edu/~climate/html_pages/download.html#T2017
The population grids typically come from this site: https://sedac.ciesin.columbia.edu/data/set/gpw-v4-population-density-rev11/data-download
So I downloaded the Willmott-Matsuura temperature data which is a single gz-file. My question: How can I aggregate the Willmott-Matssura temperature data on the country-level using R? Is there an open code for this, or has someone else maybe done it? (It's a common dataset in the literature)
Thanks for any advice!