urban_agglomerations {spData} | R Documentation

## Major urban areas worldwide

### Description

Dataset in a 'long' form from the United Nations population division with projections up to 2050. Includes only the top 30 largest areas by population at 5 year intervals.

### Usage

    urban_agglomerations

### Format

Selected variables:

- year Year of population estimate

- country_code Code of country

- urban_agglomeration Name of the urban agglomeration

- population_millions Estimated human population

- geometry sfc_POINT

### Source

https://esa.un.org/unpd/wup

### Examples

    if (requireNamespace("sf", quietly = TRUE)) {
      library(sf)
      data(urban_agglomerations)
    }
    # Code used to download the data:
    ## Not run:
    download.file(destfile = "WUP2014-F11a-30_Largest_Cities.xls",
    url = "https://esa.un.org/unpd/wup/CD-ROM/WUP2014_XLS_CD_FILES/WUP2014-F11a-30_Largest_Cities.xls")
    library(dplyr)
    library(sf)
    urban_agglomerations = readxl::read_excel("WUP2014-F11a-30_Largest_Cities.xls", skip = 16) %>%
        st_as_sf(coords = c("Longitude", "Latitude"), crs = 4326)
    names(urban_agglomerations) <- gsub(" ", "_", tolower(names(urban_agglomerations)) ) %>%
            gsub("\\(|\\)", "", .)
    devtools::use_data(urban_agglomerations, overwrite = TRUE)
    file.remove("WUP2014-F11a-30_Largest_Cities.xls")

    ## End(Not run)

[Package spData version 0.3.0 Index]