Skip to contents

This function build a data frame from a collection of spatial interaction model.

Usage

# S3 method for class 'sim_list'
as.data.frame(x, ..., models = TRUE)

Arguments

x

a collection of spatial interaction models, an object of class sim_list

...

additional parameters (not used currently)

models

whether to include the models in the data frame (defaults to TRUE, that is to model inclusion)

Value

a data frame representation of the spatial interaction model collection

Details

The data frame has one row per spatial interaction model and the following columns:

  • alpha: the return to scale parameter used to build the model

  • beta: the cost inverse scale parameter used to build the model

  • diversity: model diversity

  • terminals: if the model is not bipartite, the terminals of the model

  • model: if models=TRUE, the model

Examples

positions <- matrix(rnorm(10 * 2), ncol = 2)
distances <- as.matrix(dist(positions))
production <- rep(1, 10)
attractiveness <- c(2, rep(1, 9))
all_flows <- grid_blvim(distances, production, c(1.25, 1.5), c(1, 2, 3), attractiveness,
  bipartite = FALSE
)
as.data.frame(all_flows, models = FALSE)
#>   alpha beta diversity    terminals
#> 1  1.25    1  1.000000            1
#> 2  1.50    1  1.000000            1
#> 3  1.25    2  4.471054 1, 2, 3,....
#> 4  1.50    2  3.538074 1, 2, 3,....
#> 5  1.25    3  6.060708 1, 2, 3,....
#> 6  1.50    3  4.513024 1, 2, 3,....