Rob Weyant bio photo

Rob Weyant

Data Scientist at Powerley

Twitter LinkedIn Instagram Github Last.fm

I’m working on an R package that facilitates getting data out of the QPX Express API and into R. QPX Express API offers global airline pricing in a single, standard API. You can search it and get data on flight prices across lots of different carriers.

Installation

devtools::install_github('rweyant/googleflights')

Basic Usage

First, you need to get an API Key.

library(googleflights)

# Set API key in a place all the functions have access to
set_apikey(YOUR_APIKEY)

Get data

result <- search(origin='DTW',dest='SFO',startDate='2016-03-01',endDate='2016-03-08')

The API returns data in JSON format. The search function will parse it with fromJSON. This will return a list of lists. More information on the response format can be found here.

Next Steps

The actual API only has one method, so there’s not much else to say about working with it. The data is very rich though, but hard to use directly from JSON. My main focus moving forward here is to add functions that will make working with the returned data easier.

More Resources