|
@@ -29,7 +29,7 @@ locgraph <- graph(edges = elist)
|
29
|
29
|
sg <- decompose(locgraph, mode="weak")
|
30
|
30
|
|
31
|
31
|
|
32
|
|
-work_travel %>% rename(
|
|
32
|
+work_travel %>% select(
|
33
|
33
|
res_code = SA2_code_usual_residence_address,
|
34
|
34
|
res_name = SA2_name_usual_residence_address,
|
35
|
35
|
res_east = SA2_usual_residence_easting,
|
|
@@ -38,15 +38,15 @@ work_travel %>% rename(
|
38
|
38
|
work_name = SA2_name_workplace_address,
|
39
|
39
|
work_east = SA2_workplace_easting,
|
40
|
40
|
work_north = SA2_workplace_northing,
|
41
|
|
- home = Work_at_home,
|
42
|
41
|
private = Drive_a_private_car_truck_or_van,
|
43
|
|
- company = Drive_a_company_car_truck_or_van,
|
44
|
42
|
passenger = Passenger_in_a_car_truck_van_or_company_bus,
|
|
43
|
+ walk = Walk_or_jog,
|
|
44
|
+ bicycle = Bicycle,
|
|
45
|
+ company = Drive_a_company_car_truck_or_van,
|
45
|
46
|
bus = Public_bus,
|
46
|
47
|
train = Train,
|
47
|
|
- bicycle = Bicycle,
|
48
|
|
- walk = Walk_or_jog,
|
49
|
48
|
ferry = Ferry,
|
|
49
|
+ home = Work_at_home,
|
50
|
50
|
other = Other,
|
51
|
51
|
total = Total
|
52
|
52
|
) -> work_simp
|
|
@@ -57,15 +57,15 @@ work_simp %>%
|
57
|
57
|
res_east,
|
58
|
58
|
res_north) %>%
|
59
|
59
|
summarise(
|
60
|
|
- home = sum(ifelse(home < 0, 0, home)),
|
61
|
60
|
private = sum(ifelse(private < 0, 0, private)),
|
62
|
|
- company = sum(ifelse(company < 0, 0, company)),
|
63
|
61
|
passenger = sum(ifelse(passenger < 0, 0, passenger)),
|
|
62
|
+ walk = sum(ifelse(walk < 0, 0, walk)),
|
|
63
|
+ bicycle = sum(ifelse(bicycle < 0, 0, bicycle)),
|
|
64
|
+ company = sum(ifelse(company < 0, 0, company)),
|
64
|
65
|
bus = sum(ifelse(bus < 0, 0, bus)),
|
65
|
66
|
train = sum(ifelse(train < 0, 0, train)),
|
66
|
|
- bicycle = sum(ifelse(bicycle < 0, 0, bicycle)),
|
67
|
|
- walk = sum(ifelse(walk < 0, 0, walk)),
|
68
|
67
|
ferry = sum(ifelse(ferry < 0, 0, ferry)),
|
|
68
|
+ home = sum(ifelse(home < 0, 0, home)),
|
69
|
69
|
other = sum(ifelse(other < 0, 0, other)),
|
70
|
70
|
total = sum(ifelse(total < 0, 0, total)), .groups="drop"
|
71
|
71
|
) -> work_from
|
|
@@ -77,15 +77,15 @@ work_simp %>%
|
77
|
77
|
work_east,
|
78
|
78
|
work_north) %>%
|
79
|
79
|
summarise(
|
80
|
|
- home = sum(ifelse(home < 0, 0, home)),
|
81
|
80
|
private = sum(ifelse(private < 0, 0, private)),
|
82
|
|
- company = sum(ifelse(company < 0, 0, company)),
|
83
|
81
|
passenger = sum(ifelse(passenger < 0, 0, passenger)),
|
|
82
|
+ walk = sum(ifelse(walk < 0, 0, walk)),
|
|
83
|
+ bicycle = sum(ifelse(bicycle < 0, 0, bicycle)),
|
|
84
|
+ company = sum(ifelse(company < 0, 0, company)),
|
84
|
85
|
bus = sum(ifelse(bus < 0, 0, bus)),
|
85
|
86
|
train = sum(ifelse(train < 0, 0, train)),
|
86
|
|
- bicycle = sum(ifelse(bicycle < 0, 0, bicycle)),
|
87
|
|
- walk = sum(ifelse(walk < 0, 0, walk)),
|
88
|
87
|
ferry = sum(ifelse(ferry < 0, 0, ferry)),
|
|
88
|
+ home = sum(ifelse(home < 0, 0, home)),
|
89
|
89
|
other = sum(ifelse(other < 0, 0, other)),
|
90
|
90
|
total = sum(ifelse(total < 0, 0, total)), .groups="drop"
|
91
|
91
|
) -> work_to
|
|
@@ -142,20 +142,20 @@ edu_simp %>% group_by(edu_code, edu_name, edu_east, edu_north) %>%
|
142
|
142
|
total = sum(ifelse(total < 0, 0, total)), .groups="drop"
|
143
|
143
|
) -> edu_to
|
144
|
144
|
|
145
|
|
-tencols <- c("#fb9a99", "#e31a1c", "#1f78b4", "#6a3d9a", "#b2df8a",
|
146
|
|
- "#33a02c", "#fdbf6f", "#ff7f00", "#cab2d6", "#a6cee3")
|
|
145
|
+tencols <- c("#f85654", "#e31a1c", "#1f78b4", "#6a3d9a", "#b2df8a",
|
|
146
|
+ "#33a02c", "#fdbf6f", "#ff7f00", "#af8ac1", "#cab2d6")
|
147
|
147
|
tencols[which.max(work_from[1, 5:14])]
|
148
|
148
|
|
149
|
149
|
|
150
|
|
-work_from$MAX <- work_from %>% select(home:other) %>% as.matrix() %>%
|
|
150
|
+work_from$MAX <- work_from %>% select(private:other) %>% as.matrix() %>%
|
151
|
151
|
apply(1, function(x) {
|
152
|
152
|
ifelse(max(x) <= 0, NA, which.max(x))
|
153
|
153
|
})
|
154
|
|
-work_to$MAX <- work_to %>% select(home:other) %>% as.matrix() %>%
|
|
154
|
+work_to$MAX <- work_to %>% select(private:other) %>% as.matrix() %>%
|
155
|
155
|
apply(1, function(x) {
|
156
|
156
|
ifelse(max(x) <= 0, NA, which.max(x))
|
157
|
157
|
})
|
158
|
|
-work_simp$MAX <- work_simp %>% select(home:other) %>% as.matrix() %>%
|
|
158
|
+work_simp$MAX <- work_simp %>% select(private:other) %>% as.matrix() %>%
|
159
|
159
|
apply(1, function(x) {
|
160
|
160
|
ifelse(max(x) <= 0, NA, which.max(x))
|
161
|
161
|
})
|