od_aggregate {od}R Documentation

Aggregate od pairs based on aggregating zones

Description

This function is for aggregating OD pairs. It generally decreases the number of rows in an OD dataset, while aiming to keep the amount of travel represented in the data the same.

Usage

od_aggregate(od, aggzones = NULL, FUN = sum)

od_group(od, aggzones = NULL, FUN = sum)

Arguments

od

An origin-destination data frame

aggzones

Points within the zones defining the OD data

FUN

The aggregating function to use

Details

An alias for the function is od_group().

Examples

od_aggregated = od_data_df[1:2, c(1, 2, 9)]
aggzones = od::od_data_zones_min
subzones = od_data_zones_small
plot(aggzones$geometry)
plot(subzones$geometry, add = TRUE)
od = od_disaggregate(od_aggregated, aggzones, subzones)
od_agg = od_aggregate(od, aggzones)
names(od_agg)[1:(ncol(od_agg) - 1)] = names(od_aggregated)
attr(od_aggregated, "spec") = NULL
identical(sf::st_drop_geometry(od_agg), od_aggregated)

[Package od version 0.4.4 Index]