Learn R Programming

stplanr (version 1.2.2)

od2odf: Extract coordinates from OD data

Description

Extract coordinates from OD data

Usage

od2odf(flow, zones)

Arguments

flow

A data frame representing origin-destination data. The first two columns of this data frame should correspond to the first column of the data in the zones. Thus in cents_sf(), the first column is geo_code. This corresponds to the first two columns of flow().

zones

A spatial object representing origins (and destinations if no separate destinations object is provided) of travel.

Details

Origin-destination (OD) data is often provided in the form of 1 line per OD pair, with zone codes of the trip origin in the first column and the zone codes of the destination in the second column (see the vignette("stplanr-od")) for details. od2odf() creates an 'origin-destination data frame', with columns containing origin and destination codes (flow) that match the first column in a a spatial (polygon or point sf) object (zones).

The function returns a data frame with coordinates for the origin and destination.

See Also

Other od: od2line(), od_aggregate_from(), od_aggregate_to(), od_coords(), od_coords2line(), od_id, od_id_order(), od_oneway(), od_to_odmatrix(), odmatrix_to_od(), points2flow(), points2odf()

Examples

Run this code
od2odf(flow[1:2, ], zones_sf)

Run the code above in your browser using DataLab