Description Usage Arguments Details Value Examples
Calculates the distance between all populated areas in the spatial dataset.
1 | calc_dist_mat(spatial_data)
|
spatial_data |
The spatial dataset to use to calculate the distance matrix. |
This function calculates the distance matrix once to avoid doing it for every generation during an epidemic simulation. This is essential to later speed up the epidemic simulation. The matrix returned only contains distance between cells with non-NA values (i.e. cells with people in them). Note that this function assumes that the distances are in meters in the dataset! If that is not the case, you might want to either convert these, or adjust the output of this function.
Returns one matrix object containing the distances between all populated areas.
1 2 3 4 5 | #Create a spatial dataset:
test_data = raster::raster(nrow=10, ncol=10, xmn=1, xmx=100000, ymn=1, ymx=100000)
values(test_data) = runif(100, 1, 1000)
dist_mat = calc_dist_mat(test_data)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.