This repository has been archived by the owner on Apr 18, 2024. It is now read-only.
forked from tlorusso/twist_zrh
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.Rhistory
267 lines (267 loc) · 12.4 KB
/
.Rhistory
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
read.table("airport_coordinates.txt",sep=":")
read.table("airport_coordinates.txt",sep=":")
flights <- read.table("flightdata_zrh")
flights <- read.table("flightdata_zrh.csv")
flights <- read.table("flightdata_zrh.csv",sep=";")
flights <- read.table("flightdata_zrh.csv",sep=";")
flights <- read.table("flightdata_zrh.csv",sep=";")
flights <- read.table("flightdata_zrh.csv",sep=";")
airports <- read.table("airport_coordinates.txt",sep=":")
View(flights)
flights <- read.table("flightdata_zrh.csv",sep=";",header=TRUE)
airports <- read.table("airport_coordinates.txt",sep=":",header=TRUE)
flights %>% left_join(aiports, by=c("origin_destination"="iata"))
library(tidyverse)
flights %>% left_join(aiports, by=c("origin_destination"="iata"))
flights %>% left_join(airports, by=c("origin_destination"="iata"))
flights_airports <- flights %>% left_join(airports, by=c("origin_destination"="iata"))
View(flights_airports)
flights_airports2 <- flights %>% left_join(airports, by=c("origin_destination"="icao"))
View(flights)
View(airports)
flights_airports2 %>% filter(is.na(icao))
flights_airports2 <- flights %>% left_join(airports, by=c("origin_destination"="icao"))
summary(flights_airports2)
summary(flights_airports)
flights_airports %>% group_by(airports) %>% summarize(n=n())
flights_airports %>%
group_by(origin_destination) %>%
summarize(n=n())
airports_n <- flights_airports %>%
group_by(origin_destination) %>%
summarize(n=n())
View(airports_n)
airports_n <- flights_airports %>%
group_by(origin_destination) %>%
summarize(n=n())
View(airports_n)
#airport database : http://www.partow.net/miscellaneous/airportdatabase/
airports <- read.table("airports.csv",sep=";",header=TRUE)
#airport database : http://www.partow.net/miscellaneous/airportdatabase/
airports <- read.csv("airports.csv",header=TRUE)
#airport database : http://www.partow.net/miscellaneous/airportdatabase/
airports <- read.csv("airports.csv",sep=";",header=TRUE)
View(airports)
#airport database : http://www.partow.net/miscellaneous/airportdatabase/
airports <- read.csv("airports.csv",sep=",",header=TRUE)
#airport database : http://www.partow.net/miscellaneous/airportdatabase/
airports <- read.csv("airports.csv",sep=";")
View(airports)
#airport database : http://www.partow.net/miscellaneous/airportdatabase/
airports <- read.csv("airports.csv",sep=",")
View(airports)
#airport database : http://www.partow.net/miscellaneous/airportdatabase/
airports <- read.csv("airports.csv")
#airport database : http://www.partow.net/miscellaneous/airportdatabase/
airports <- read.csv("airports.csv")
View(airports)
# airport data for 151657 flights not available?
flights_airports <- flights %>% left_join(airports, by=c("origin_destination"="iata_code"))
summary(fligths_airports)
summary(fligths_airports)
summary(flights_airports)
airports %>%
group_by(iata_code) %>%
count()
airports %>%
group_by(iata_code) %>%
count() %>%
count()
iata_red <-airports %>%
group_by(iata_code) %>%
count()
View(iata_red)
View(flights_airports)
flights <- read.table("flightdata_zrh.csv",sep=";",header=TRUE) %>% mutate(id=nrow())
flights <- read.table("flightdata_zrh.csv",sep=";",header=TRUE) %>%
mutate(id=row_number())
# airport data for 71 flights not available? redundat data for ca.14'000 flights?
flights_airports <- flights %>% left_join(airports, by=c("origin_destination"="iata_code"))
flights_airports %>% group_by(id) %>% summarize(n=n())
# airport data for 71 flights not available? redundat data for ca.14'000 flights?
flights_airports <- flights %>% left_join(airports, by=c("origin_destination"="iata_code"))
flights <- read.table("flightdata_zrh.csv",sep=";",header=TRUE) %>%
mutate(rowid=row_number())
# airport data for 71 flights not available? redundat data for ca.14'000 flights?
flights_airports <- flights %>% left_join(airports, by=c("origin_destination"="iata_code"))
flights_airports %>%
group_by(rowid) %>%
summarize(n=n())
flights_airports %>%
group_by(rowid) %>%
summarize(n=n()) %>%
arrange(desc(n))
duplicates <- flights_airports %>%
group_by(rowid) %>%
mutate(n=n()) %>%
arrange(desc(n))
View(duplicates)
View(flights_airports)
#airport database : http://ourairports.com/ -> open aiport data http://ourairports.com/data/
airports <- read.csv("airports.csv") %>% filter(iata_code!="small_airport")
# airport data for 71 flights not available? redundat data for ca.14'000 flights?
flights_airports <- flights %>% left_join(airports, by=c("origin_destination"="iata_code"))
airports <- read.csv("airports.csv") %>%
filter(iata_code!="small_airport")
#airport database : http://ourairports.com/ -> open aiport data http://ourairports.com/data/
airports <- read.csv("airports.csv") %>%
filter(type!="small_airport")
# airport data for 71 flights not available? redundat data for ca.14'000 flights?
flights_airports <- flights %>% left_join(airports, by=c("origin_destination"="iata_code"))
airports_n <- flights_airports %>%
group_by(origin_destination) %>%
summarize(n=n())
iata_red <-airports %>%
group_by(iata_code) %>%
count()
View(iata_red)
duplicates <- flights_airports %>%
group_by(rowid) %>%
mutate(n=n()) %>%
arrange(desc(n))
View(duplicates)
airports <- read.csv("airports.csv") %>%
#filter small airports as ther appears to be a minor airport with the same iatacode as CDG (paris)
filter(type!%in% c("small_airport","closed"))
#airport database : http://ourairports.com/ -> open aiport data http://ourairports.com/data/
airports <- read.csv("airports.csv") %>%
#filter small airports as ther appears to be a minor airport with the same iatacode as CDG (paris)
filter(type %in% !c("small_airport","closed"))
#airport database : http://ourairports.com/ -> open aiport data http://ourairports.com/data/
airports <- read.csv("airports.csv") %>%
#filter small airports as ther appears to be a minor airport with the same iatacode as CDG (paris)
filter(!type %in% c("small_airport","closed"))
# airport data for 71 flights not available? redundat data for ca.14'000 flights?
flights_airports <- flights %>%
left_join(airports, by=c("origin_destination"="iata_code"))
#redundant flights? double airports?
duplicates <- flights_airports %>%
group_by(rowid) %>%
mutate(n=n()) %>%
arrange(desc(n))
duplicates <- flights_airports %>%
group_by(rowid) %>%
mutate(n=n()) %>%
arrange(desc(n))
View(duplicates)
airports <- read.csv("airports.csv") %>%
#filter small airports as ther appears to be a minor airport with the same iatacode as CDG (paris) or were closed and replaced by new airports (e.g. Hongkong)
filter(!type %in% c("small_airport","closed") | !is.na(latitude_deg))
flights_airports <- flights %>%
left_join(airports, by=c("origin_destination"="iata_code"))
#airport database : http://ourairports.com/ -> open aiport data http://ourairports.com/data/
airports <- read.csv("airports.csv") %>%
#filter small airports as ther appears to be a minor airport with the same iatacode as CDG (paris) or were closed and replaced by new airports (e.g. Hongkong)
filter(!type %in% c("small_airport","closed"))
#airport database : http://ourairports.com/ -> open aiport data http://ourairports.com/data/
airports <- read.csv("airports.csv") %>%
#filter small airports as ther appears to be a minor airport with the same iatacode as CDG (paris) or were closed and replaced by new airports (e.g. Hongkong)
filter(!type %in% c("small_airport","closed")) %>%
filter(is.na(!latitude_deg))
#airport database : http://ourairports.com/ -> open aiport data http://ourairports.com/data/
airports <- read.csv("airports.csv") %>%
#filter small airports as ther appears to be a minor airport with the same iatacode as CDG (paris) or were closed and replaced by new airports (e.g. Hongkong)
filter(!type %in% c("small_airport","closed")) %>%
filter(!is.na(latitude_deg))
# airport data for 71 flights not available? redundat data for ca.14'000 flights?
flights_airports <- flights %>%
left_join(airports, by=c("origin_destination"="iata_code"))
airports1 <- read.csv("airports.csv") %>%
#filter small airports as ther appears to be a minor airport with the same iatacode as CDG (paris) or were closed and replaced by new airports (e.g. Hongkong)
filter(!type %in% c("small_airport","closed"))
airports1 <- read.csv("airports.csv") %>%
#filter small airports as ther appears to be a minor airport with the same iatacode as CDG (paris) or were closed and replaced by new airports (e.g. Hongkong)
filter(!type %in% c("small_airport","closed")) %>%
filter(!is.na(latitude_deg))
View(airports1)
#airport database : http://ourairports.com/ -> open aiport data http://ourairports.com/data/
airports1 <- read.csv("airports.csv") %>%
#filter small airports : one small airports has the same iatacode as CDG (paris), others were closed and replaced by new airports (e.g. Hongkong) and are redundant
filter(!type %in% c("small_airport","closed")) %>%
filter(!is.na(latitude_deg))
airports <- read.csv("airports.csv") %>%
#filter small airports : one small airports has the same iatacode as CDG (paris), others were closed and replaced by new airports (e.g. Hongkong) and are redundant
filter(!type %in% c("small_airport","closed")) %>%
filter(!is.na(latitude_deg))
# airport data for 71 flights not available? redundat data for ca.14'000 flights?
flights_airports <- flights %>%
left_join(airports, by=c("origin_destination"="iata_code"))
View(duplicates)
airports <- read.csv("airports.csv") %>%
#filter small airports : one small airports has the same iatacode as CDG (paris), others were closed and replaced by new airports (e.g. Hongkong) and are redundant
filter(!type %in% c("small_airport","closed")) %>%
filter(latitude_deg==0 & longitude_deg==0)
View(airports)
airports <- read.csv("airports.csv") %>%
#filter small airports : one small airports has the same iatacode as CDG (paris), others were closed and replaced by new airports (e.g. Hongkong) and are redundant
filter(!type %in% c("small_airport","closed")) %>%
#filter airports with missing geocoordinates
filter(latitude_deg!=0 & longitude_deg!=0)
# airport data for 71 flights not available? redundat data for ca.14'000 flights?
flights_airports3 <- flights %>%
left_join(airports, by=c("origin_destination"="iata_code"))
duplicates <- flights_airports3 %>%
group_by(rowid) %>%
mutate(n=n()) %>%
arrange(desc(n))
View(duplicates)
airports <- read.csv("airports.csv") %>%
#filter small airports : one small airports has the same iatacode as CDG (paris), others were closed and replaced by new airports (e.g. Hongkong) and are redundant
filter(!type %in% c("small_airport","closed")) %>%
#filter airports with missing geocoordinates
filter(latitude_deg!=0 & longitude_deg!=0) %>%
#filter duplicate OR Tambo International Airport
filter(id!=31055)
# airport data for 71 flights not available? redundat data for ca.14'000 flights?
flights_airports <- flights %>%
left_join(airports, by=c("origin_destination"="iata_code"))
summarize(flights_airports)
summarise(flights_airports)
summary(flights_airports)
flights_airports$effective_time
hms(flights_airports$effective_time[1])
lubridate::hms(flights_airports$effective_time[1])
flights_airports$effective_time[1]
flights_airports$effective_time[1,]
flights_airports <- flights %>%
left_join(airports, by=c("origin_destination"="iata_code")) %>%
#generate time difference - planed vs effective
mutate(timediff=lubridate::hms(flights_airports$planed_time)-lubridate::hms(flights_airports$effective_time))
View(flights_airports)
# airport data for 71 flights not available?
flights_airports <- flights %>%
left_join(airports, by=c("origin_destination"="iata_code")) %>%
#generate time difference - planed vs effective
mutate(difference=difftime(effective_time,planed_time,units="minutes") )
difftime(flights$effective_time[1]-flights$planed_time[1])
difftime(flights$effective_time[1],flights$planed_time[1])
flights$effective_time[1]
flights_airports <- flights %>%
left_join(airports, by=c("origin_destination"="iata_code")) %>%
#generate time difference - planed vs effective
mutate(effective_time1=lubridate::hms(effective_time),
planed_time1=lubridate::hms(planed_time))
difftime(flights$effective_time1[1],flights$planed_time1[1])
flights$effective_time1[1]
difftime(flights_airports$effective_time1[1],flights_airports$planed_time1[1])
as.period(flights_airports$effective_time1[1]-flights_airports$planed_time1[1])
rm(duplicates)
rm(flights)
rm(flights_airports2)
flight_sf <- readRDS("L:/STAT/08_DS/06_Diffusion/OGD/data_publication/twist_zrh/flight_sf.RDS")
View(flight_sf)
plot(flight_sf)
plot(flight_sf)
plot(flight_sf$geometry)
plot(flight_sf)
View(flight_sf)
flight_sf %>% filter(!is.na(geometry)) %>% plot()
library(tidyverse)
flight_sf %>%
filter(!is.na(geometry)) %>%
plot()
flight_sf %>%
filter(!is.na(geometry)) %>%
plot(geometry)
ggplot(flight_sf)+
geom_sf()