knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>",
  fig.path = "README-"
)

require(webTRISr)
require(pixiedust)
require(magrittr)

webTRISr

Build Status CRAN

A R package for the WebTRIS Traffic Flow API, from Highways England.

Feedback and contributions welcome - please raise an issue or pull request.

Installation

install.packages('webTRISr')

or

install.packages('devtools')
devtools::install_github('departmentfortransport/webTRISr')

Examples

Reports

Reports can be downloaded, as data frames, using webtris_report()

webtris_report(sites=c('7', '24'),
               start_date = '01012017', end_date = '01022017',
               report_type = 'monthly-summary')
x <- webtris_report(sites=c('7', '24'),
               start_date = '01012017', end_date = '01022017',
               report_type = 'monthly-summary')

x[] %>% dust() %>%
  sprinkle(cols=1, halign = "left") %>%
  sprinkle_print_method("markdown")

All reports currently provided by the API are availble by changing the report_type argument. At present these options are: "daily", "annual-totals", "annual-monthly", "monthly-summary", "monthly-daily", "monthly-daily-aggregate", and "monthly-hourly-aggregate".

Areas

webtris_areas()
head(webtris_areas()) %>% dust() %>%
  sprinkle(cols=1, halign = "left") %>%
  sprinkle_print_method("markdown")

Sites

webtris_sites()
head(webtris_sites())%>% dust() %>%
  sprinkle(cols=1, halign = "left") %>%
  sprinkle_print_method("markdown")

Quality

webtris_quality(siteID = '2', start_date = '01012017', end_date = '01022017')
head(webtris_quality(siteID = '2', start_date = '01012017', end_date = '01022017')
)%>% dust() %>%
  sprinkle(cols=1, halign = "left") %>%
  sprinkle_print_method("markdown")


departmentfortransport/webTRISr documentation built on May 15, 2020, 5:03 p.m.