Learn R Programming

TDLM (version 1.1.1)

extract_opportunities: Compute the number of opportunities between pairs of locations

Description

This function computes the number of opportunities between pairs of locations as defined in Lenormand et al. (2016). For a given pair of locations, the number of opportunities between the origin location and the destination location is based on the number of opportunities within a circle of radius equal to the distance between the origin and the destination, with the origin location as the center. The number of opportunities at the origin and destination locations are not included.

Usage

extract_opportunities(opportunity, distance, check_names = FALSE)

Value

A squared matrix in which each element represents the number of opportunities between a pair of locations.

Arguments

opportunity

A numeric vector representing the number of opportunities per location. The value should be positive.

distance

A squared matrix representing the distances between locations.

check_names

A boolean indicating whether the location IDs are used as vector names, matrix row names, and matrix column names, and whether they should be checked (see Note).

Author

Maxime Lenormand (maxime.lenormand@inrae.fr)

References

Lenormand M, Bassolas A, Ramasco JJ (2016) Systematic comparison of trip distribution laws and models. Journal of Transport Geography 51, 158-169.

See Also

Associated functions: extract_distances(), extract_spatial_information().

Examples

Run this code
data(mass)
data(distance)

opportunity <- mass[, 1]

sij <- extract_opportunities(opportunity = opportunity,
                             distance = distance,
                             check_names = FALSE)

Run the code above in your browser using DataLab