https://github.com/jonocarroll/sahansard
Wraps the SA Parliament Hansard API
https://github.com/jonocarroll/sahansard
api-wrapper australia hansard parliament politics r
Last synced: about 1 year ago
JSON representation
Wraps the SA Parliament Hansard API
- Host: GitHub
- URL: https://github.com/jonocarroll/sahansard
- Owner: jonocarroll
- Created: 2017-02-25T13:19:18.000Z (about 9 years ago)
- Default Branch: master
- Last Pushed: 2017-02-26T12:16:48.000Z (about 9 years ago)
- Last Synced: 2025-01-16T02:53:19.435Z (about 1 year ago)
- Topics: api-wrapper, australia, hansard, parliament, politics, r
- Language: CSS
- Size: 178 KB
- Stars: 1
- Watchers: 4
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.Rmd
Awesome Lists containing this project
README
---
output: github_document
---
# SA Hansard

[](https://cran.r-project.org/package=SAHansard)
Wraps the SA Hansard API (http://parliament-api-docs.readthedocs.io/en/latest/south-australia/), producing "tidy" `data.frame` objects or rendering the resulting HTML.
```{r, echo = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "README-"
)
suppressPackageStartupMessages(source("R/scrape.R"))
```
## Installation
This package can be installed from GitHub using the `devtools::install_github` method:
```{r, eval=FALSE}
devtools::install_github("jonocarroll/SAHansard")
```
## Examples
Obtain all SA Hansard records for a given year
```{r, cache=TRUE}
hansard_year(year = "2017")
```
From these, a given Table of Contents can be obtained (for a given `docid` from `hansard_year`)
```{r, cache=TRUE}
# normally just evaluating hansard_toc is what you want,
# here I only want to show limited results
glimpse(hansard_toc(docid = 'HANSARD-10-19980'))
```
From these, a HTML fragment can be obtained (use the `pdfid` from `hansard_toc`)
***
```{r, cache=TRUE, results='asis'}
# the print method for this result opens the
# rendered HTML fragment in the RStudio Viewer with
# CSS obtained from the Hansard site.
# Here I am just printing the content
hansard_fragment(pdfid = 'HANSARD-10-19961')$content
```
***