View source: R/extract_opportunities.R
extract_opportunities | R Documentation |
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.
extract_opportunities(opportunity, distance, check_names = FALSE)
opportunity |
A |
distance |
A squared |
check_names |
A |
A squared matrix
in which each element represents the number of
opportunities between a pair of locations.
opportunity
and distance
should be based on the same number of
locations sorted in the same order. It is recommended to use the location ID
as matrix
rownames
and matrix
colnames
and to set
check_names = TRUE
to verify that everything is consistent before running
this function (check_names = FALSE
by default). Note that the function
check_format_names()
can be used to validate all inputs
before running the main package's functions.
Maxime Lenormand (maxime.lenormand@inrae.fr)
Lenormand M, Bassolas A, Ramasco JJ (2016) Systematic comparison of trip distribution laws and models. Journal of Transport Geography 51, 158-169.
Associated functions:
extract_distances()
, extract_spatial_information()
.
data(mass)
data(distance)
opportunity <- mass[, 1]
sij <- extract_opportunities(opportunity = opportunity,
distance = distance,
check_names = FALSE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.