## generate vectors of industrial and population count
ind <- c(0, 10, 10, 30, 50)
pop <- c(10, 15, 20, 25, 30)
## run the function (30% of the population produces 50% of the industrial output)
hoover_index(ind, pop)
## generate a region - industry matrix
mat <- matrix(
c(
0, 10, 0, 0,
0, 15, 0, 0,
0, 20, 0, 0,
0, 25, 0, 1,
0, 30, 1, 1
),
ncol = 4, byrow = TRUE
)
rownames(mat) <- c("R1", "R2", "R3", "R4", "R5")
colnames(mat) <- c("I1", "I2", "I3", "I4")
## run the function
hoover_index(mat, pop)
## run the function by aggregating all industries
hoover_index(rowSums(mat), pop)
## run the function for industry #1 only
hoover_index(mat[, 1], pop)
## run the function for industry #2 only (perfectly proportional to population)
hoover_index(mat[, 2], pop)
## run the function for industry #3 only (30% of the pop. produces 100% of the output)
hoover_index(mat[, 3], pop)
## run the function for industry #4 only (55% of the pop. produces 100% of the output)
hoover_index(mat[, 4], pop)
Run the code above in your browser using DataLab