Title: | Handle Personal Oyster Journey History Data Provided by Transport for London |
---|---|
Description: | You can opt-in to monthly emails from Transport for London (TfL) that have your Oyster journey history attached as a CSV. Functions in this small package help you read, wrangle and summarise these data. I, and this work, are unaffiliated with Transport for London (TfL). |
Authors: | Matt Dray [aut, cre] |
Maintainer: | Matt Dray <[email protected]> |
License: | MIT + file LICENSE |
Version: | 0.0.0.9000 |
Built: | 2024-11-01 06:25:37 UTC |
Source: | https://github.com/matt-dray/oystr |
An anonymised example of a single month's journey history data received
originally as a CSV from Transport for London, read with
oy_read()
and cleaned with oy_clean()
.
data(journeys_clean)
data(journeys_clean)
An object of class "data.frame"
.
Data generated and received originally from (Transport for London).
data(journeys_clean)
data(journeys_clean)
An anonymised example of a single month's journey history data received
originally as a CSV from Transport for London and read with
oy_read()
.
data(journeys_read)
data(journeys_read)
An object of class data.frame
.
Data generated and received originally from (Transport for London).
data(journeys_read)
data(journeys_read)
Process a data.frame object containing Oyster journey history data. Could be a raw file as received by email from Transport for London or the output from oy_read().
oy_clean(x)
oy_clean(x)
x |
A data.frame object containing Oyster journey history. |
A data.frame objectwith 13 columns and as many rows as journeys.
## Not run: my_df <- oy_read("path/to/folder/") my_df_clean <- oy_clean(my_df) ## End(Not run)
## Not run: my_df <- oy_read("path/to/folder/") my_df_clean <- oy_clean(my_df) ## End(Not run)
A named vector of hexadecimal colour values from Transport for London's colour standard. Includes corporate, mode-specific and safety colours, as well as London Underground line colours.
oy_cols(...)
oy_cols(...)
... |
Provide either the names or indices of colours in the vector (see details). |
An empty call returns the whole vector. The colour names are as follows:
corporate: corporate_blue, corporate_red, corporate_grey, corporate_dark_grey, corporate_yellow, corporate_green, corporate_black, corporate_white
mode-specific: transport_for_london, line_elizabeth, london_overground, emirates_air_line, santander_cycles, london_river_services, london_underground, london_buses, london_dial_a_ride, taxi_private_hire, visitor_centre, london_coaches, docklands_light_railway, tfl_rail
safety: safety_blue, corporate_red, corporate_yellow, corporate_green
London Underground lines: line_bakerloo, line_hammersmith_city, line_piccadilly, line_central, line_jubilee, line_victoria, line_circle, line_metropolitan, line_waterloo_city, line_district, line_northern
other logos and identities: oyster_blue, oyster_cyan, legible_london_blue, legible_london_yellow
A named vector object.
oy_cols() # return full named vector oy_cols("oyster_blue", "oyster_cyan") # return named values oy_cols(1:5) # return first five elements
oy_cols() # return full named vector oy_cols("oyster_blue", "oyster_cyan") # return named values oy_cols(1:5) # return first five elements
Outputs a simple time series line plot of Oyster journey data that's been
cleaned with oy_clean
.
oy_lineplot( data, x_var = "datetime_start", y_var = "journey_duration", weekdays = FALSE, mode = "Train" )
oy_lineplot( data, x_var = "datetime_start", y_var = "journey_duration", weekdays = FALSE, mode = "Train" )
data |
|
x_var |
The name of the variable from |
y_var |
The name of the continuous variable from |
weekdays |
Logical. |
mode |
Currently restricted to |
A plot.
## Not run: my_df <- oy_read("path/to/folder/") my_df_clean <- oy_clean(my_df) oy_lineplot(my_df_clean, y_var = "Balance", weekdays = FALSE) ## End(Not run)
## Not run: my_df <- oy_read("path/to/folder/") my_df_clean <- oy_clean(my_df) oy_lineplot(my_df_clean, y_var = "Balance", weekdays = FALSE) ## End(Not run)
Read one or more Oyster journey history files from a single folder and combine them. Assumes journey histories are raw CSV files as received by email from Transport for London. Ignores files that are not identified as Oyster history journey files.
oy_read(path)
oy_read(path)
path |
A string describing a filepath to a folder of Oyster journey history CSV files. |
A data.frame object with 8 columns and as many rows as journeys.
## Not run: my_df <- oy_read("path/to/folder/") ## End(Not run)
## Not run: my_df <- oy_read("path/to/folder/") ## End(Not run)
Generate simple summaries of your Oyster journey history data for a quick overview.
oy_summary(data, mode = "Train")
oy_summary(data, mode = "Train")
data |
Data frame output from |
mode |
Currently restricted to |
A list object where each element is some kind of data summary.
## Not run: my_df <- oy_read("path/to/folder/") my_df_clean <- oy_clean(my_df) oy_summary(my_df_clean, mode = "Train") ## End(Not run)
## Not run: my_df <- oy_read("path/to/folder/") my_df_clean <- oy_clean(my_df) oy_summary(my_df_clean, mode = "Train") ## End(Not run)