od_coordinates {od} | R Documentation |
Create matrices representing origin-destination coordinates
Description
This function takes a wide range of input data types (spatial lines, points or text strings) and returns a data frame of coordinates representing origin (ox, oy) and destination (dx, dy) points.
Usage
od_coordinates(x, p = NULL, pd = NULL, silent = TRUE, sfnames = FALSE)
Arguments
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? |
Value
A data frame with origin and destination coordinates
Examples
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)
[Package od version 0.4.4 Index]