This function takes a data frame representing travel between origins (with origin codes in name_orig, typically the 1st column) and destinations (with destination codes in name_dest, typically the second column) and returns a matrix with cell values (from attrib, the third column by default) representing travel between origins and destinations.

od_to_odmatrix(x, attrib = 3, name_orig = 1, name_dest = 2)

Arguments

x

A data frame representing flows between origin and destinations

attrib

A number or character string representing the column containing the attribute data of interest from the flow data frame

name_orig

A number or character string representing the zone of origin

name_dest

A number or character string representing the zone of destination

See also

Other od: od_id, odmatrix_to_od()

Examples

x = od_data_df[1:4, ]
x_matrix = od_to_odmatrix(x)
class(x_matrix)
#> [1] "matrix" "array" 
od_to_odmatrix(x, attrib = "bicycle")
#>           E02006875
#> E02002384        13
#> E02002404        10
#> E02006875         8
#> E02006876        10