Title: | Generates Networks from BTS Data |
---|---|
Description: | A flexible tool that allows generating bespoke air transport statistics for urban studies based on publicly available data from the Bureau of Transport Statistics (BTS) in the United States <https://www.transtats.bts.gov/databases.asp?Z1qr_VQ=E&Z1qr_Qr5p=N8vn6v10&f7owrp6_VQF=D>. |
Authors: | Filipe Teixeira [aut, cre] |
Maintainer: | Filipe Teixeira <[email protected]> |
License: | MIT + file LICENSE |
Version: | 1.4.4 |
Built: | 2024-12-11 06:13:09 UTC |
Source: | https://github.com/ropensci/skynet |
This data comes from the RITA/Transtats database
A dataframe with 422 observations and 2 variables
USA airport data from the RITA/Transtats database
A dataframe with 6435 observations and 5 variables
USA airport data from the RITA/Transtats database
A dataframe with 6435 observations and 9 variables
World airport data from the RITA/Transtats database
A dataframe with 13555 observations and 28 variables
Bootstraps a network and returns output containing three network statistics: Average Path Length, Transitivity, Mean Betweenness.
boot_network(g, n = 500, left_ci = 0.005, right_ci = 0.995)
boot_network(g, n = 500, left_ci = 0.005, right_ci = 0.995)
g |
iGraph graph or skynet object. |
n |
Number of bootstraps to run. (500 default) |
left_ci |
Confidence interval left limit. (0.005 default) |
right_ci |
Confidence interval left limit (0.995 default) |
## Not run: boot_net(g, n = 500) ## End(Not run)
## Not run: boot_net(g, n = 500) ## End(Not run)
This data comes from the RITA/Transtats database
A dataframe with 1738 observations and 2 variables
Creates nodes for SKYNET's functions. Despite being possible to use it individually, it's mainly meant to be used as a complimentary function.
createNodes(y)
createNodes(y)
y |
Data Frame |
Uses the Serrano's disparity filter (https://en.wikipedia.org/wiki/Disparity_filter_algorithm_of_weighted_network) to extract the backbone of the network in "Extracting the multiscale backbone of complex weighted networks"
disparity_filter(g, alpha = 0.003)
disparity_filter(g, alpha = 0.003)
g |
igraph object |
alpha |
Alpha value. Default 0.003 |
## Not run: netDir <- make.netDir(OD_Sample) disparity_filter(netDir$gDir, alpha = 0.003) ## End(Not run)
## Not run: netDir <- make.netDir(OD_Sample) disparity_filter(netDir$gDir, alpha = 0.003) ## End(Not run)
Downloads data from BTS/RITA/Transtats and imports it into R
download_db1b(y = NULL, q = NULL)
download_db1b(y = NULL, q = NULL)
y |
year to be imported |
q |
quarter to be imported |
Coupon files can be found at https://www.transtats.bts.gov/Fields.asp?gnoyr_VQ=FLM. Ticket files can be found at https://www.transtats.bts.gov/Fields.asp?gnoyr_VQ=FKF.
Note: The BTS often changes the way we can access these files. So please be warned that this is still an experimental feature.
## Not run: download_db1b(2010, 1) ## End(Not run)
## Not run: download_db1b(2010, 1) ## End(Not run)
Download On-Time Performance Data directly from BTS/RITA/Transtats website raw data (prezipped file), for SKYNET's import function.
download_ontime(y, m, auto = TRUE)
download_ontime(y, m, auto = TRUE)
y |
year to be imported |
m |
month to be imported |
auto |
Automatically assigns object |
## Not run: import_ontime(skynet_example("Ontime.csv")) ## End(Not run)
## Not run: import_ontime(skynet_example("Ontime.csv")) ## End(Not run)
Downloads data from BTS/RITA/Transtats and imports it into R
download_t100(y = NULL, type = NULL)
download_t100(y = NULL, type = NULL)
y |
year to be imported |
type |
"mkt" for Market, "seg" for Segment databases respectively |
Note: The BTS often changes the way we can access these files. So please be warned that this is still an experimental feature.
## Not run: download_t100(2010, "mkt") ## End(Not run)
## Not run: download_t100(2010, "mkt") ## End(Not run)
Downloads data from BTS/RITA/Transtats and imports it into R
download_t100_int(y = NULL, type = NULL)
download_t100_int(y = NULL, type = NULL)
y |
year to be imported |
type |
"mkt" for Market, "seg" for Segment databases respectively |
Note: The BTS often changes the way we can access these files. So please be warned that this is still an experimental feature.
## Not run: download_t100_int(2010, "mkt") ## End(Not run)
## Not run: download_t100_int(2010, "mkt") ## End(Not run)
Searches for airport information based on its IATA code or city name It will display multiple airports as it works with partial names.
find_airport(x)
find_airport(x)
x |
airport IATA code or city name |
## Not run: find_airport("Atlanta") find_airport("ATL") ## End(Not run)
## Not run: find_airport("Atlanta") find_airport("ATL") ## End(Not run)
Searches for airport information based on its IATA code or city name
find_carrier(x)
find_carrier(x)
x |
Carrier |
## Not run: find_carrier("United") find_carrier("UA") ## End(Not run)
## Not run: find_carrier("United") find_carrier("UA") ## End(Not run)
Plots power law fit
fit_power(graph)
fit_power(graph)
graph |
iGraph object |
## Not run: netDir <- make.netDir(OD_Sample) fit_power(netDir$gDir) ## End(Not run)
## Not run: netDir <- make.netDir(OD_Sample) fit_power(netDir$gDir) ## End(Not run)
Calculate edges weight from IATA Code
from_to_stats(x, y, orig)
from_to_stats(x, y, orig)
x |
igraph object to query |
y |
origin airport IATA code |
orig |
"from" or "to" options |
## Not run: netDir <- make.netDir(OD_Sample) from_to_stats(netDir$gDir, "JFK", orig = "from") from_to_stats(netDir$gDir, "JFK", orig = "to") ## End(Not run)
## Not run: netDir <- make.netDir(OD_Sample) from_to_stats(netDir$gDir, "JFK", orig = "from") from_to_stats(netDir$gDir, "JFK", orig = "to") ## End(Not run)
Imports data from BTS/RITA/Transtats files
import_db1b(c, t, zip = FALSE, auto = TRUE)
import_db1b(c, t, zip = FALSE, auto = TRUE)
c |
Coupon csv file to be imported, in case of DB1B database |
t |
Ticket csv file to be imported, in case of DB1B database |
zip |
Should equal TRUE if original file comes from the BTS prezipped option. |
auto |
Automatically assigns object |
Coupon files can be found at https://www.transtats.bts.gov/Fields.asp?gnoyr_VQ=FLM. Ticket files can be found at https://www.transtats.bts.gov/Fields.asp?gnoyr_VQ=FKF. Both files should belong to the same year and same quarter. Note: We do recommend sparklyr to be used for larger sets of data. More information on variables to select and type of files to use can be found here
## Not run: import_db1b(skynet_example("Coupon_2001Q1.csv"), skynet_example("Ticket_2001Q1.csv")) ## End(Not run)
## Not run: import_db1b(skynet_example("Coupon_2001Q1.csv"), skynet_example("Ticket_2001Q1.csv")) ## End(Not run)
Imports on-time Data directly from BTS/RITA/Transtats website raw data (prezipped file), for SKYNET's import function.
import_ontime(x, auto = TRUE)
import_ontime(x, auto = TRUE)
x |
On-time csv (from zipped file) |
auto |
Automatically assigns object |
Files can be found here https://www.transtats.bts.gov/Fields.asp?gnoyr_VQ=FGJ. More information on variables to select and type of files to use can be found here
## Not run: import_ontime(skynet_example("Ontime_2011_1.csv")) ## End(Not run)
## Not run: import_ontime(skynet_example("Ontime_2011_1.csv")) ## End(Not run)
Imports T-100 Data directly from BTS/RITA/Transtats website raw data (prezipped file), for SKYNET's import function.
import_t100(x, nonsch = FALSE, auto = TRUE)
import_t100(x, nonsch = FALSE, auto = TRUE)
x |
T-100 csv |
nonsch |
Should equal TRUE to include non-scheduled flights |
auto |
Automatically assigns object |
Files can be found here https://www.transtats.bts.gov/Fields.asp?gnoyr_VQ=FIL. More information on variables to select and type of files to use can be found here
## Not run: import_t100(skynet_example("T100_2011_mkt.csv")) ## End(Not run)
## Not run: import_t100(skynet_example("T100_2011_mkt.csv")) ## End(Not run)
Generates Directed Network with an iGraph gDir object, a Data Frame netDir and a Data Frame with Airport/Nodes statistics nodes.
make_net_dir( x, disp = FALSE, alpha = 0.003, cap = FALSE, pct = 10, carrier = FALSE, metro = FALSE )
make_net_dir( x, disp = FALSE, alpha = 0.003, cap = FALSE, pct = 10, carrier = FALSE, metro = FALSE )
x |
Data frame |
disp |
Uses the Serrano's disparity filter (https://en.wikipedia.org/wiki/Disparity_filter_algorithm_of_weighted_network) to extract the backbone of the network. |
alpha |
Argument for disparity filter. |
cap |
Filters original data based on the edge weight. |
pct |
Argument for cap filter. Value should be imput as percentage. |
carrier |
Groups data per carrier and OD |
metro |
Groups data by metropolitan area |
## Not run: make_net_dir(OD_Sample) # Apply Disparity Filter make_net_dir(OD_Sample, disp = TRUE, alpha = 0.05) # Apply Percentage Cap make_net_dir(OD_Sample, cap = TRUE, pct = 20) ## End(Not run)
## Not run: make_net_dir(OD_Sample) # Apply Disparity Filter make_net_dir(OD_Sample, disp = TRUE, alpha = 0.05) # Apply Percentage Cap make_net_dir(OD_Sample, cap = TRUE, pct = 20) ## End(Not run)
Generates an OD network and a Leg Count data frame(on demand)
make_net_path(x, leg = FALSE, zero = FALSE, carrier = FALSE)
make_net_path(x, leg = FALSE, zero = FALSE, carrier = FALSE)
x |
Data frame |
leg |
Generates Leg Count Data frame, based on Path taken. |
zero |
Displays percentage of 0 usd tickets |
carrier |
Groups data per airline For example, all passengers doing the BOS-ATL-LAX path, are summed by Air Carrier. |
## Not run: make_net_path(OD_Sample) # Generate Leg Count make_net_path(OD_Sample, leg = TRUE) ## End(Not run)
## Not run: make_net_path(OD_Sample) # Generate Leg Count make_net_path(OD_Sample, leg = TRUE) ## End(Not run)
Generates Trip/Route based Directed Network with an iGraph gDir object, a Data Frame netDir and a Data Frame with Airport/Nodes statistics nodes. Returns type of trip: OD = Origin/Destination pair, OT = Origin/Transfer pair, TT = Transfer/Transfer pair, TD = Transfer/Destination pair
make_net_trip(x, carrier = FALSE)
make_net_trip(x, carrier = FALSE)
x |
Data frame |
carrier |
Groups data per carrier and OD |
## Not run: make_net_trip(OD_Sample) ## End(Not run)
## Not run: make_net_trip(OD_Sample) ## End(Not run)
Generates Undirected Network with an iGraph gUnd object, a Data Frame netUnd and a Data Frame with Airport/Nodes statistics nodes.
make_net_und( x, disp = FALSE, alpha = 0.003, cap = FALSE, pct = 10, merge = TRUE, carrier = FALSE, metro = FALSE )
make_net_und( x, disp = FALSE, alpha = 0.003, cap = FALSE, pct = 10, merge = TRUE, carrier = FALSE, metro = FALSE )
x |
Data frame |
disp |
Uses the Serrano's disparity filter (https://en.wikipedia.org/wiki/Disparity_filter_algorithm_of_weighted_network) to extract the backbone of the network. |
alpha |
Argument for disparity filter. |
cap |
Filters original data based on the edge weight. |
pct |
Argument for cap filter. Value should be imput as percentage. |
merge |
When set to FALSE, it keeps parallel edges instead of collapsing them and summing their weights. |
carrier |
Groups data per carrier and OD |
metro |
Groups data by metropolitan area |
## Not run: make_net_und(OD_Sample) # Apply Disparity Filter make_net_und(OD_Sample, disp = TRUE, alpha = 0.05) # Apply Percentage Cap make_net_und(OD_Sample, cap = TRUE, pct = 20) ## End(Not run)
## Not run: make_net_und(OD_Sample) # Apply Disparity Filter make_net_und(OD_Sample, disp = TRUE, alpha = 0.05) # Apply Percentage Cap make_net_und(OD_Sample, cap = TRUE, pct = 20) ## End(Not run)
Imports International data to complement to the DB1B data set. NOTE: When using this function, certain variables will be skewed as the T100 dataset does not contain all the data the DB1B dataset contains.
make.netInt(x = NULL, m = NULL, Q = NULL)
make.netInt(x = NULL, m = NULL, Q = NULL)
x |
T-100 International Segment csv file |
m |
Data set to merge with |
Q |
Desired T-100 Quarter. Should be equal to 1, 2, 3 or 4. |
## Not run: make.netInt(skynet_example("T100_2011_int.csv"), OD_Sample, 1) ## End(Not run)
## Not run: make.netInt(skynet_example("T100_2011_int.csv"), OD_Sample, 1) ## End(Not run)
This data comes from the RITA/Transtats database
A dataframe with 5802 observations and 5 variables
This data comes from the RITA/Transtats database
A dataframe with 5802 observations and 2 variables
Creates OD ggplot2 generated maps from make.net functions Shows sample of 60
net_map(x, pct = 60)
net_map(x, pct = 60)
x |
Skynet Object (generated by make_net_dir,make_net_und or make_net_path) |
pct |
percentage of edges to include |
## Not run: network <- make.netDir(OD_Sample) net_map(network, pct = 10) ## End(Not run)
## Not run: network <- make.netDir(OD_Sample) net_map(network, pct = 10) ## End(Not run)
Imports data from BTS/RITA/Transtats website File order doesn't matter, but it is recommended to name the files using the following syntax: "Coupon YearQuarter.csv", "Ticket YearQuarter.csv", "T100 Year". Note: We do recommend sparklyr to be used for larger sets of data.
netImport(x = NULL, y = NULL)
netImport(x = NULL, y = NULL)
x |
First csv file to be imported, in case of DB1B database, or in case of using the T-100 database, the only file to be included. |
y |
Second csv file to be imported. |
## Not run: netImport(skynet_example("Coupon_2001Q1.csv"), skynet_example("Ticket_2001Q1.csv")) ## End(Not run)
## Not run: netImport(skynet_example("Coupon_2001Q1.csv"), skynet_example("Ticket_2001Q1.csv")) ## End(Not run)
Creates node statistics Generates Number of Passenger Arrivals, Departures and Transfers
node_stats(x)
node_stats(x)
x |
Data Frame to extract information from |
## Not run: node_stats(OD_Sample) ## End(Not run)
## Not run: node_stats(OD_Sample) ## End(Not run)
Create Metro Nodes
nodeStatsMetro(y)
nodeStatsMetro(y)
y |
Data Frame |
## Not run: nodeStatsMetro(OD_Sample) ## End(Not run)
## Not run: nodeStatsMetro(OD_Sample) ## End(Not run)
Sample data to use with SKYNET functions
A dataframe with 500.000 observations and 19 variables
To access csv examples from SKYNET
skynet_example(path = NULL)
skynet_example(path = NULL)
path |
File name. |
## Not run: skynet_example() skynet_example("Coupon 2001Q1.csv") ## End(Not run)
## Not run: skynet_example() skynet_example("Coupon 2001Q1.csv") ## End(Not run)
Displays a summary of a skynet object
## S3 method for class 'skynet' summary(object, ...)
## S3 method for class 'skynet' summary(object, ...)
object |
skynet object to summarise |
... |
other arguments ignored (for compatibility with generic) |
net <- make_net_dir(OD_Sample) summary(net)
net <- make_net_dir(OD_Sample) summary(net)