|
@@ -46,8 +46,8 @@ work_travel %>% select(
|
46
|
46
|
bus = Public_bus,
|
47
|
47
|
train = Train,
|
48
|
48
|
ferry = Ferry,
|
49
|
|
- home = Work_at_home,
|
50
|
49
|
other = Other,
|
|
50
|
+ home = Work_at_home,
|
51
|
51
|
total = Total
|
52
|
52
|
) -> work_simp
|
53
|
53
|
|
|
@@ -65,8 +65,8 @@ work_simp %>%
|
65
|
65
|
bus = sum(ifelse(bus < 0, 0, bus)),
|
66
|
66
|
train = sum(ifelse(train < 0, 0, train)),
|
67
|
67
|
ferry = sum(ifelse(ferry < 0, 0, ferry)),
|
68
|
|
- home = sum(ifelse(home < 0, 0, home)),
|
69
|
68
|
other = sum(ifelse(other < 0, 0, other)),
|
|
69
|
+ home = sum(ifelse(home < 0, 0, home)),
|
70
|
70
|
total = sum(ifelse(total < 0, 0, total)), .groups="drop"
|
71
|
71
|
) -> work_from
|
72
|
72
|
|
|
@@ -85,8 +85,8 @@ work_simp %>%
|
85
|
85
|
bus = sum(ifelse(bus < 0, 0, bus)),
|
86
|
86
|
train = sum(ifelse(train < 0, 0, train)),
|
87
|
87
|
ferry = sum(ifelse(ferry < 0, 0, ferry)),
|
88
|
|
- home = sum(ifelse(home < 0, 0, home)),
|
89
|
88
|
other = sum(ifelse(other < 0, 0, other)),
|
|
89
|
+ home = sum(ifelse(home < 0, 0, home)),
|
90
|
90
|
total = sum(ifelse(total < 0, 0, total)), .groups="drop"
|
91
|
91
|
) -> work_to
|
92
|
92
|
|
|
@@ -107,8 +107,8 @@ edu_simp <- education_travel %>% select(
|
107
|
107
|
pubbus = Public_bus,
|
108
|
108
|
train = Train,
|
109
|
109
|
ferry = Ferry,
|
110
|
|
- home = Study_at_home,
|
111
|
110
|
other = Other,
|
|
111
|
+ home = Study_at_home,
|
112
|
112
|
total = Total
|
113
|
113
|
)
|
114
|
114
|
|
|
@@ -122,8 +122,8 @@ edu_simp %>% group_by(res_code, res_name, res_east, res_north) %>%
|
122
|
122
|
pubbus = sum(ifelse(pubbus < 0, 0, pubbus)),
|
123
|
123
|
train = sum(ifelse(train < 0, 0, train)),
|
124
|
124
|
ferry = sum(ifelse(ferry < 0, 0, ferry)),
|
125
|
|
- home = sum(ifelse(home < 0, 0, home)),
|
126
|
125
|
other = sum(ifelse(other < 0, 0, other)),
|
|
126
|
+ home = sum(ifelse(home < 0, 0, home)),
|
127
|
127
|
total = sum(ifelse(total < 0, 0, total)), .groups="drop"
|
128
|
128
|
) -> edu_from
|
129
|
129
|
|
|
@@ -137,38 +137,38 @@ edu_simp %>% group_by(edu_code, edu_name, edu_east, edu_north) %>%
|
137
|
137
|
pubbus = sum(ifelse(pubbus < 0, 0, pubbus)),
|
138
|
138
|
train = sum(ifelse(train < 0, 0, train)),
|
139
|
139
|
ferry = sum(ifelse(ferry < 0, 0, ferry)),
|
140
|
|
- home = sum(ifelse(home < 0, 0, home)),
|
141
|
140
|
other = sum(ifelse(other < 0, 0, other)),
|
|
141
|
+ home = sum(ifelse(home < 0, 0, home)),
|
142
|
142
|
total = sum(ifelse(total < 0, 0, total)), .groups="drop"
|
143
|
143
|
) -> edu_to
|
144
|
144
|
|
145
|
145
|
tencols <- c("#f85654", "#e31a1c", "#1f78b4", "#6a3d9a", "#b2df8a",
|
146
|
|
- "#33a02c", "#fdbf6f", "#ff7f00", "#af8ac1", "#cab2d6")
|
|
146
|
+ "#33a02c", "#fdbf6f", "#ff7f00", "#cab2d6", "#af8ac1")
|
147
|
147
|
tencols[which.max(work_from[1, 5:14])]
|
148
|
148
|
|
149
|
149
|
|
150
|
|
-work_from$MAX <- work_from %>% select(private:other) %>% as.matrix() %>%
|
|
150
|
+work_from$MAX <- work_from %>% select(private:home) %>% 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(private:other) %>% as.matrix() %>%
|
|
154
|
+work_to$MAX <- work_to %>% select(private:home) %>% 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(private:other) %>% as.matrix() %>%
|
|
158
|
+work_simp$MAX <- work_simp %>% select(private:home) %>% as.matrix() %>%
|
159
|
159
|
apply(1, function(x) {
|
160
|
160
|
ifelse(max(x) <= 0, NA, which.max(x))
|
161
|
161
|
})
|
162
|
162
|
|
163
|
|
-edu_from$MAX <- edu_from %>% select(drive:other) %>% as.matrix() %>%
|
|
163
|
+edu_from$MAX <- edu_from %>% select(drive:home) %>% as.matrix() %>%
|
164
|
164
|
apply(1, function(x) {
|
165
|
165
|
ifelse(max(x) <= 0, NA, which.max(x))
|
166
|
166
|
})
|
167
|
|
-edu_to$MAX <- edu_to %>% select(drive:other) %>% as.matrix() %>%
|
|
167
|
+edu_to$MAX <- edu_to %>% select(drive:home) %>% as.matrix() %>%
|
168
|
168
|
apply(1, function(x) {
|
169
|
169
|
ifelse(max(x) <= 0, NA, which.max(x))
|
170
|
170
|
})
|
171
|
|
-edu_simp$MAX <- edu_simp %>% select(drive:other) %>% as.matrix() %>%
|
|
171
|
+edu_simp$MAX <- edu_simp %>% select(drive:home) %>% as.matrix() %>%
|
172
|
172
|
apply(1, function(x) {
|
173
|
173
|
ifelse(max(x) <= 0, NA, which.max(x))
|
174
|
174
|
})
|