# number of rows in the census data - base
head( nrow(census_data) )
# number of rows in the census data - family homes: year of construction
# - family homes: household structure
# Note: information from some census sections has been suppressed to protect statistical confidentiality
head( nrow(census_homes_year_of_construction_data) )
head( nrow(census_household_structure_data) )
# construct the identifier - family homes: year of construction
census_homes_year_of_construction_data$ccaa = as.integer(17)
census_homes_year_of_construction_data$CPRO = as.integer(substr(census_homes_year_of_construction_data$home_year_id, 1, 2))
census_homes_year_of_construction_data$CMUN = as.integer(substr(census_homes_year_of_construction_data$home_year_id, 3, 5))
census_homes_year_of_construction_data$dist = as.integer(substr(census_homes_year_of_construction_data$home_year_id, 6, 7))
census_homes_year_of_construction_data$secc = as.integer(substr(census_homes_year_of_construction_data$home_year_id, 8, 10))
# construct the identifier - family homes: household structure
census_household_structure_data$ccaa = as.integer(17)
census_household_structure_data$CPRO = as.integer(substr(census_household_structure_data$household_structure_id, 1, 2))
census_household_structure_data$CMUN = as.integer(substr(census_household_structure_data$household_structure_id, 3, 5))
census_household_structure_data$dist = as.integer(substr(census_household_structure_data$household_structure_id, 6, 7))
census_household_structure_data$secc = as.integer(substr(census_household_structure_data$household_structure_id, 8, 10))
# merge using the identifier
census_data <- merge(census_data, census_homes_year_of_construction_data, by=identifier, all.x=TRUE)
census_data <- merge(census_data, census_household_structure_data, by=identifier, all.x=TRUE)
head(census_data)
Social Vulnerability Logroño - Census Data#
Environment#
R Libraries#
Any required R libraries are imported into the kernal:
Output directory#
Load Data#
Import the csv data#
Prepare data#
We only require a subset of the census data for our purposes. We therefore need to extract the relevant data, then combine these to create our vulnerability indicators.
In addition, the raw data is not suitable for use within the vulnerabiltiy assessment. It needs to be normalised based on the number of people/households within each small area. Therefore, the data is converted to percentages based on the total persons/households within each small area.
Supporting data#
Code that uniquely identifies the census area#
Merge Census datasets#
Totals#
Population total#
Dwellings total#
Households total#
Domain data#
Age domain#
Health domain#
Income domain#
Information Access/Use domain#
Local knowledge domain#
Physical access domain#
Social Network domain data#
Housing Characteristics domain#
Combine all data into one table#
Calculate Z-Score#
The raw data is not suitable for use within the vulnerabiltiy assessment. It needs to be standardised. Therefore, the data is converted to z-scores. Z-scores are:
Calculate the Z-score#
Output the Z-score data#
END