| get.matrix | R Documentation |
This function creates regions - industries (incidence) matrices from regular data frames (long to wide format) using the reshape2 package or the Matrix package
get.matrix (data)
data |
is a data frame with three columns (regions, industries, count) |
sparse |
Logical; shall the returned output be a sparse matrix? Defaults to FALSE, but can be set to TRUE if the dataset is very large |
Pierre-Alexandre Balland p.balland@uu.nl
get.list
## generate a region - industry data frame
set.seed(31)
region <- c("R1", "R1", "R1", "R1", "R2", "R2", "R3", "R4", "R5", "R5")
industry <- c("I1", "I2", "I3", "I4", "I1", "I2", "I1", "I1", "I3", "I3")
data <- data.frame (region, industry)
data$count <- 1
## run the function
get.matrix (data)
get.matrix (data, sparse = TRUE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.