od_coordinates | R Documentation |
This function takes an 'od data frame' with the first two columns matching IDs of spatial objects, and matches them with objects representing origins and destinations in wide range of input data types (spatial lines, points or text strings). It returns a data frame of coordinates representing movement between all origin (ox, oy) and destination (dx, dy) points.
od_coordinates(x, p = NULL, pd = NULL, silent = TRUE, sfnames = FALSE)
x |
A data frame in which the first two columns are codes representing points/zones of origin and destination |
p |
Points representing origins and destinations |
pd |
Points representing destinations, if different from origin points |
silent |
Hide messages? |
sfnames |
Should output column names be compatible with the sf package? |
See points_to_od()
for a function that creates
an 'od data frame' from a set (or two sets) of points.
A data frame with origin and destination coordinates
x = od_data_df
p = od_data_centroids
res = od_coordinates(x, p)[1:2, ]
class(res)
res
od_coordinates(x, p, sfnames = TRUE)[1:2, ]
od_coordinates(x, p, silent = FALSE)[1:2, ]
od_coordinates(x, p)
x = od_data_df2[1:3, ]
p = od_data_centroids2
pd = od_data_destinations
od_coordinates(x, p, pd)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.