Invented towns on a plane and gravity-model commuting flows between them,
generated by data-raw/demo.R. Nothing here describes a real place;
coordinates are metres in an arbitrary local plane.
Format
demo_nodes: a data frame with 24 rows (towns) and columns
- id
town code,
"T01"to"T24";- label
invented town name;
- x, y
planar coordinates, metres;
- population
inhabitants, usable as
weight;- district
one of
"North","Coast","Valley", usable asgroup.
demo_flows: a data frame of daily trips with columns origin,
destination (town codes), value (trips) and category, the purpose
of the trips ("work", "study" or "leisure"): one row per pair and
purpose, so flowmap() draws one line per purpose (see its section
"Lines"; lines = "off" ignores them). The trips of a pair add up over
the purposes; the rows with origin == destination are trips within a
town.
demo_boundary: a two-column matrix, a closed outline around the towns,
for the boundary argument of flowmap().
An object of class data.frame with 548 rows and 4 columns.
An object of class matrix (inherits from array) with 41 rows and 2 columns.
Examples
head(demo_nodes)
#> id label x y population district
#> 1 T01 Marar 32914 59404 240000 North
#> 2 T02 Belpal 31397 46365 55900 North
#> 3 T03 Quinmar 36060 59349 5500 North
#> 4 T04 Falir 29714 53508 4600 North
#> 5 T05 Arjun 35183 62609 26600 North
#> 6 T06 Halbel 43768 58863 9300 North
head(demo_flows)
#> origin destination value category
#> 1 T01 T01 597 work
#> 2 T01 T01 477 study
#> 3 T01 T01 126 leisure
#> 4 T01 T02 1081 work
#> 5 T01 T02 83 study
#> 6 T01 T02 97 leisure
tapply(demo_flows$value, demo_flows$category, sum)
#> leisure study work
#> 13063 21509 54402
m <- flowmap(demo_nodes, demo_flows, boundary = demo_boundary)
m
#> <milkflow> 24 places (from 24 nodes), 25 segments, 5 width classes
#> Volume: 88,974 in 180 pairs (180 routed)
#> in corridors 98.1%
#> internal 1.9%
#> filtered out 0.0%
#> without a path 0.0%
#> Lines: 3 categories on 25 segments, 129 crossings at nodes
#> leisure 14.8% of the drawn volume
#> study 24.0% of the drawn volume
#> work 61.3% of the drawn volume
#> Detour: mean 1.10, max 5.09