|
@@ -27,3 +27,68 @@ locgraph <- graph(edges = elist)
|
27
|
27
|
# plot(locgraph, label = NA)
|
28
|
28
|
|
29
|
29
|
sg <- decompose(locgraph, mode="weak")
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+work_travel %>% rename(
|
|
33
|
+ res_code = SA2_code_usual_residence_address,
|
|
34
|
+ res_name = SA2_name_usual_residence_address,
|
|
35
|
+ res_east = SA2_usual_residence_easting,
|
|
36
|
+ res_north = SA2_usual_residence_northing,
|
|
37
|
+ work_code = SA2_code_workplace_address,
|
|
38
|
+ work_name = SA2_name_workplace_address,
|
|
39
|
+ work_east = SA2_workplace_easting,
|
|
40
|
+ work_north = SA2_workplace_northing,
|
|
41
|
+ home = Work_at_home,
|
|
42
|
+ private = Drive_a_private_car_truck_or_van,
|
|
43
|
+ company = Drive_a_company_car_truck_or_van,
|
|
44
|
+ passenger = Passenger_in_a_car_truck_van_or_company_bus,
|
|
45
|
+ bus = Public_bus,
|
|
46
|
+ train = Train,
|
|
47
|
+ bicycle = Bicycle,
|
|
48
|
+ walk = Walk_or_jog,
|
|
49
|
+ ferry = Ferry,
|
|
50
|
+ other = Other,
|
|
51
|
+ total = Total
|
|
52
|
+) -> work_simp
|
|
53
|
+
|
|
54
|
+work_simp %>%
|
|
55
|
+ group_by(res_code,
|
|
56
|
+ res_name,
|
|
57
|
+ res_east,
|
|
58
|
+ res_north) %>%
|
|
59
|
+ summarise(
|
|
60
|
+ home = sum(ifelse(home < 0, 0, home)),
|
|
61
|
+ private = sum(ifelse(private < 0, 0, private)),
|
|
62
|
+ company = sum(ifelse(company < 0, 0, company)),
|
|
63
|
+ passenger = sum(ifelse(passenger < 0, 0, passenger)),
|
|
64
|
+ bus = sum(ifelse(bus < 0, 0, bus)),
|
|
65
|
+ train = sum(ifelse(train < 0, 0, train)),
|
|
66
|
+ bicycle = sum(ifelse(bicycle < 0, 0, bicycle)),
|
|
67
|
+ walk = sum(ifelse(walk < 0, 0, walk)),
|
|
68
|
+ ferry = sum(ifelse(ferry < 0, 0, ferry)),
|
|
69
|
+ other = sum(ifelse(other < 0, 0, other)),
|
|
70
|
+ total = sum(ifelse(total < 0, 0, total)), .groups="drop"
|
|
71
|
+ ) -> work_from
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+work_simp %>%
|
|
75
|
+ group_by(work_code,
|
|
76
|
+ work_name,
|
|
77
|
+ work_east,
|
|
78
|
+ work_north) %>%
|
|
79
|
+ summarise(
|
|
80
|
+ home = sum(ifelse(home < 0, 0, home)),
|
|
81
|
+ private = sum(ifelse(private < 0, 0, private)),
|
|
82
|
+ company = sum(ifelse(company < 0, 0, company)),
|
|
83
|
+ passenger = sum(ifelse(passenger < 0, 0, passenger)),
|
|
84
|
+ bus = sum(ifelse(bus < 0, 0, bus)),
|
|
85
|
+ train = sum(ifelse(train < 0, 0, train)),
|
|
86
|
+ bicycle = sum(ifelse(bicycle < 0, 0, bicycle)),
|
|
87
|
+ walk = sum(ifelse(walk < 0, 0, walk)),
|
|
88
|
+ ferry = sum(ifelse(ferry < 0, 0, ferry)),
|
|
89
|
+ other = sum(ifelse(other < 0, 0, other)),
|
|
90
|
+ total = sum(ifelse(total < 0, 0, total)), .groups="drop"
|
|
91
|
+ ) -> work_to
|
|
92
|
+
|
|
93
|
+tencols <- c("#a6cee3", "#1f78b4", "#b2df8a", "#33a02c", "#fb9a99",
|
|
94
|
+ "#e31a1c", "#fdbf6f", "#ff7f00", "#cab2d6", "#6a3d9a")
|