Missing column names in Large Urban Areas population CSV

tabular data
metadata
importance: low
Author
Published

July 17, 2024

Modified

August 17, 2024


Status: ✅ resolved

Importance: 1 - low

Summary: CSV file with Large Urban Areas population data is missing column names.

Expected Results: The dataset should have ID and population columns.


Resolution: resolved with https://github.com/Robinlovelace/spanishoddata/pull/25 in {spanishoddata} R package.

To get valid spatial data, use spanishoddata::spod_get_zones()

install.packages("spanishoddata",
  repos = c("https://e-kotov.r-universe.dev", "https://cloud.r-project.org"))

zones <- spanishoddata::spod_get_zones("gau", ver = 2)

Steps to Reproduce

  1. Load Data

Load libraries and define data files.

library(tidyverse)
library(here)
library(DT)

gau_population_file <- here("data/raw_data/v2/zonificacion/zonificacion_GAU/poblacion_gaus.csv")

Load the data and join the Large Urban Areas names to the boundaries.

gau_population <- read.delim(gau_population_file, sep = "|")

Results

  1. Missing column names
names(gau_population)
[1] "X01001"  "X2925.0"
str(gau_population)
'data.frame':   2085 obs. of  2 variables:
 $ X01001 : chr  "01002" "01004_AM" "01009_AM" "01010" ...
 $ X2925.0: num  10307 3005 4599 2951 4314 ...
  1. Preview of the Large Urban Areas population table
DT::datatable(gau_population)