How to find the population-weighted centre of local administrative units

Preliminary note: All code for this post is available at this link. Various operations described in these posts were facilitated by a new R package, latlon2map; the package has already a basic vignette, with the title “Removing the boring parts from geocomputation with European data”. For a number of data visualisations and data analysis it is useful to have the coordinates of the centre of a town or municipality. In a lengthy post (in Italian), Andrea Borruso highlighted why this can be useful, pointed at a number of alternative solutions, and to some of their shortcomings.