Learn R Programming

EconGeo (version 2.0)

get_list: Create regular data frames from regions - industries matrices

Description

This function creates regular data frames with three columns (regions, industries, count) from (incidence) matrices (wide to long format) using the reshape2 package

Usage

get_list(mat)

Value

A data frame with three columns: "Region" (representing the region), "Industry" (representing the industry), and "Count" (representing the count of occurrences)

Arguments

mat

An incidence matrix with regions in rows and industries in columns (or the other way around)

Author

Pierre-Alexandre Balland p.balland@uu.nl

See Also

get_matrix

Examples

Run this code
## generate a region - industry matrix
set.seed(31)
mat <- matrix(sample(0:100, 20, replace = TRUE), ncol = 4)
rownames(mat) <- c("R1", "R2", "R3", "R4", "R5")
colnames(mat) <- c("I1", "I2", "I3", "I4")

## run the function
get_list(mat)

Run the code above in your browser using DataLab