From 1c137aaabf7946a4320d65db09282566550b0478 Mon Sep 17 00:00:00 2001 From: David Liao <35374714+davidycliao@users.noreply.github.com> Date: Sun, 17 Sep 2023 01:24:30 +0100 Subject: [PATCH 1/5] UPDATE v0.1.6 --- DESCRIPTION | 2 -- R/zzz.R | 42 ++++++++++++++++++++++--- _pkgdown.yml | 12 +++++++ inst/README.Rmd | 7 ----- inst/README.md | 56 +++++++++++++++++++++++++++++++++ man/dot-onAttach.Rd | 4 +-- vignettes/get_legislators.Rmd | 4 +-- vignettes/get_parlquestions.Rmd | 4 +-- vignettes/manual.Rmd | 3 +- vignettes/quickstart.Rmd | 16 +--------- 10 files changed, 114 insertions(+), 36 deletions(-) create mode 100644 inst/README.md diff --git a/DESCRIPTION b/DESCRIPTION index a8182516..6167f3b6 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -32,8 +32,6 @@ Suggests: remotes, tidyverse, testthat (>= 3.0.0) -Config/Needs/website: - tidyverse/tidytemplate RoxygenNote: 7.2.3 BugReports: https://github.com/davidycliao/legisTaiwan/issues URL: https://davidycliao.github.io/legisTaiwan/ diff --git a/R/zzz.R b/R/zzz.R index 31493d64..37332e54 100644 --- a/R/zzz.R +++ b/R/zzz.R @@ -1,8 +1,42 @@ -### Package Utility Functions -#' On package attach, display a startup message to the user. +#' On package attach, display a startup message #' #' @keywords internal .onAttach <- function(...) { - packageStartupMessage("## legisTaiwan ##") - packageStartupMessage("## An R package connecting to the Taiwan Legislative API. ##") + # ANSI color codes + dark_green <- "\033[38;5;22m" # Deep Green color + red <- "\033[31m" + orange <- "\033[38;5;214m" + yellow <- "\033[33m" + green <- "\033[32m" + blue <- "\033[34m" + indigo <- "\033[38;5;54m" + violet <- "\033[35m" + reset <- "\033[0m" + + # Coloring Taiwan in rainbow colors + rainbow_taiwan <- paste0( + red, "T", + orange, "a", + yellow, "i", + green, "w", + blue, "a", + indigo, "n", + reset + ) + + # Creating the first message + message1 <- paste0(dark_green, "legis", reset, rainbow_taiwan) + + # Maximum allowed length + max_len <- 64 + num_spaces <- max_len - nchar(message1, type = "bytes") - 4 + num_spaces <- max(0, num_spaces) + + message1 <- paste0("## ", message1, rep(" ", num_spaces), " ##") + + # Second message + message2 <- "## An R package connecting to the Taiwan Legislative API. ##" + + packageStartupMessage(message1) + packageStartupMessage(message2) } diff --git a/_pkgdown.yml b/_pkgdown.yml index ae430b7f..16b36884 100644 --- a/_pkgdown.yml +++ b/_pkgdown.yml @@ -88,6 +88,18 @@ navbar: - text: "Function Reference" href: reference/index.html + - icon: fa-file-code-o + text: Tutorial + menu: + - text: "The Records of the Bills" + href: articles/get_bills.html + - text: "Demographic Data" + href: articles/get_legislators.html + - text: "Parliarmentary Questions" + href: articles/get_parlquestions.html + - text: "Party Caucus Negotiation" + href: articles/Party Caucus Negotiation.html + - icon: fa-newspaper-o text: News menu: diff --git a/inst/README.Rmd b/inst/README.Rmd index f1fa4220..da9a8b1a 100644 --- a/inst/README.Rmd +++ b/inst/README.Rmd @@ -15,13 +15,6 @@ knitr::opts_chunk$set( ``` -```{r setup2, include = FALSE} -library(rmarkdown) - -render("README.Rmd", output_format = "github_document", output_dir = "..") - -``` - # Real-time and Archives of Taiwan Legislative Data in R diff --git a/inst/README.md b/inst/README.md new file mode 100644 index 00000000..e144b91a --- /dev/null +++ b/inst/README.md @@ -0,0 +1,56 @@ + + + +# Real-time and Archives of Taiwan Legislative Data in R + + + +[![R](https://github.com/davidycliao/legisTaiwan/actions/workflows/r.yml/badge.svg)](https://github.com/davidycliao/legisTaiwan/actions/workflows/r.yml) +[![codecov](https://codecov.io/gh/davidycliao/legisTaiwan/branch/master/graph/badge.svg?token=HVVTCOE90D)](https://codecov.io/gh/davidycliao/legisTaiwan) +[![R-CMD-check](https://github.com/davidycliao/legisTaiwan/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/davidycliao/legisTaiwan/actions/workflows/R-CMD-check.yaml) +[![Test +coverage](https://github.com/davidycliao/legisTaiwan/actions/workflows/test-coverage.yaml/badge.svg)](https://github.com/davidycliao/legisTaiwan/actions/workflows/test-coverage.yaml) +[![pkgdown](https://github.com/davidycliao/legisTaiwan/actions/workflows/pkgdown.yaml/badge.svg)](https://github.com/davidycliao/legisTaiwan/actions/workflows/pkgdown.yaml) +[![CodeFactor](https://www.codefactor.io/repository/github/davidycliao/legistaiwan/badge)](https://www.codefactor.io/repository/github/davidycliao/legistaiwan) +[![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.7633962.svg)](https://doi.org/10.5281/zenodo.7633962) + + +
+ +`legisTaiwan` is designed to download the real-time archives of Taiwan +legislative data easily. This package includes many streamlined +functions to access [Taiwan Legislative Yuan +API](https://data.ly.gov.tw/index.action) in R without any hassle or +runarounds. + +
+ +
+ +## Get Started with Using [`remotes`](https://github.com/r-lib/remotes): + +``` r +install.packages("remotes") +remotes::install_github("davidycliao/legisTaiwan", force = TRUE) +``` + +``` r +library(legisTaiwan) +#> ## legisTaiwan ## +#> ## An R package connecting to the Taiwan Legislative API. ## +``` + +## Caution: + +
+ +`legisTaiwan` requires a stable internet connection to retrieve data +from the API. While most functions can fetch data spanning a long +period, they tend to be bandwidth-intensive due to the size of the +datasets. If you plan to download data over an extended period, I +recommend using get_variable_info() first to verify the current file +sizes on the API manual. Also, consider writing a batch retrieval +process with appropriate handlers to track the progress of file input, +ensuring the completeness of the requested data. + +
diff --git a/man/dot-onAttach.Rd b/man/dot-onAttach.Rd index 90879cf7..c4760ce4 100644 --- a/man/dot-onAttach.Rd +++ b/man/dot-onAttach.Rd @@ -2,11 +2,11 @@ % Please edit documentation in R/zzz.R \name{.onAttach} \alias{.onAttach} -\title{On package attach, display a startup message to the user.} +\title{On package attach, display a startup message} \usage{ .onAttach(...) } \description{ -On package attach, display a startup message to the user. +On package attach, display a startup message } \keyword{internal} diff --git a/vignettes/get_legislators.Rmd b/vignettes/get_legislators.Rmd index a93138a0..7ea7204e 100644 --- a/vignettes/get_legislators.Rmd +++ b/vignettes/get_legislators.Rmd @@ -1,9 +1,9 @@ --- -title: "Legislator's Democraphic Data" +title: "Legislator's Demographic Data" author: "" output: rmarkdown::html_vignette vignette: > - %\VignetteIndexEntry{Legislator's Democraphic Data} + %\VignetteIndexEntry{Legislator's Demographic Data} %\VignetteEngine{knitr::rmarkdown} %\VignetteEncoding{UTF-8} --- diff --git a/vignettes/get_parlquestions.Rmd b/vignettes/get_parlquestions.Rmd index 0a0a5fcc..5599a653 100644 --- a/vignettes/get_parlquestions.Rmd +++ b/vignettes/get_parlquestions.Rmd @@ -1,9 +1,9 @@ --- -title: "Parliarmentary Questions" +title: "Fetching Parliarmentary Questions" author: "" output: rmarkdown::html_vignette vignette: > - %\VignetteIndexEntry{Parliarmentary Questions} + %\VignetteIndexEntry{Fetching Parliarmentary Questions} %\VignetteEngine{knitr::rmarkdown} %\VignetteEncoding{UTF-8} --- diff --git a/vignettes/manual.Rmd b/vignettes/manual.Rmd index 6ffff90e..09b9440a 100644 --- a/vignettes/manual.Rmd +++ b/vignettes/manual.Rmd @@ -21,8 +21,7 @@ assign("has_internet_via_proxy", TRUE, environment(curl::has_internet))
-Parliamentary activities such as debates and written parliamentary questions, play a significant role in most parliamentary democracies. For example, the floor debate -functions as a major platform for Members of Parliament (MPs) to uncover information and discussion regarding government policy, proposed new laws and topical issues of the +Parliamentary activities such as debates and written parliamentary questions, play a significant role in most parliamentary democracies. For example, the floor debate functions as a major platform for Members of Parliament (MPs) to uncover information and discussion regarding government policy, proposed new laws and topical issues of the day.
diff --git a/vignettes/quickstart.Rmd b/vignettes/quickstart.Rmd index fd2f288e..7f842c9c 100644 --- a/vignettes/quickstart.Rmd +++ b/vignettes/quickstart.Rmd @@ -19,7 +19,7 @@ knitr::opts_chunk$set(
**`legisTaiwan`** is an R package for accessing [Taiwan Legislative Yuan API](https://data.ly.gov.tw/index.action). The goal of `legisTaiwan` is to make it quickly and instantly download Taiwan's legislative data, digitized textual -and video records for a research project and analyze public policies. Its initial development was part of David Yen-Chieh Liao' Dissertation project **[Electoral Reform, Distributive Politics, and Parties in the Taiwanese Congress](https://raw.githack.com/davidycliao/phd-thesis/main/Yen_Chieh_Liao_PhD_Dissertation_Jan_2023.pdf)** supported by 2021 Taiwanese Overseas Pioneers Grant (TOP GRANT), the National Science and Technology Council (NSTC) of Taiwan. The package is, therefore, of great benefit to researchers, students, and policy analysts interested in Taiwan legislative politics (and Taiwan politics in general) with fewer financial resources. In addition, the annotation of digitized text and labelled records of video contents may interest researchers and students who want to build an algorithm for computational research in social science and make Taiwan's democracy more transparent and accountable. +and video records for a research project and analyze public policies.
@@ -37,22 +37,8 @@ library(legisTaiwan) ----- -## Tutorials - -+ [取得「歷屆委員學經歷、與委員會擔任成員之歷史資料」為例 (李宜展 東海大學政治系碩士生)](https://davidycliao.github.io/legisTaiwan/articles/get_legislators.html) - - -+ [取得「立委質詢」為例 (李宜展 東海大學政治系碩士生)](https://davidycliao.github.io/legisTaiwan/articles/get_parlquestions.html) - -+ [取得以「法律提案」為例 (李宜展 東海大學政治系碩士生)](https://davidycliao.github.io/legisTaiwan/articles/get_bills.html) - -+ [取得「黨團協商」為例 (陳逸儒 清華大學資訊系統與應用研究所博士生)](https://davidycliao.github.io/legisTaiwan/articles/get_bills.html) - -
------ - ## How to Contribute
From f0c86d2bc1410a3ce419cd5703e0f6398d89be40 Mon Sep 17 00:00:00 2001 From: David Liao <35374714+davidycliao@users.noreply.github.com> Date: Sun, 17 Sep 2023 01:29:23 +0100 Subject: [PATCH 2/5] UPDATE --- DESCRIPTION | 2 +- _pkgdown.yml | 10 ++++++++-- vignettes/get_parlquestions.Rmd | 2 +- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index 6167f3b6..5c12b3f5 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,7 +1,7 @@ Package: legisTaiwan Type: Package Title: An Interface to Access Taiwan Legislative API in R -Version: 0.1.4 +Version: 0.1.6 Authors@R: c(person("David Yen-Chieh", "Liao", email = "davidycliao@gmail.com", role = c("aut", "cre")), person("Li", "Tang", email = "l.tang@mdx.ac.uk", role = c("ctb", "aut")), person("Taiwan Legislative Yuan 立法院", role = c("cph", "fnd")), diff --git a/_pkgdown.yml b/_pkgdown.yml index 16b36884..9abcfc91 100644 --- a/_pkgdown.yml +++ b/_pkgdown.yml @@ -10,12 +10,18 @@ home: href: https://twcongress.weebly.com/2228326371360392600924235.html - text: legisCrawler 爬台灣立法委員問政專輯的爬蟲小幫手️🕸️ href: https://davidycliao.github.io/legisCrawler/ + - text: "Text and Policy Research Group @ UCD" + href: https://text-and-policy.com + - text: "The Connected_Politics Lab @ UCD" + href: https://www.ucd.ie/connected_politics/ + - text: "legisTaiwan: An Interface to Access Taiwan Legislative API in R" + href: https://davidycliao.github.io/legisTaiwan/ - text: "LACAN: Legislators, Accountability and Collective Agency" href: https://projectlacan.wordpress.com/team/ - text: "ParlSpeech: Legislative Speeches in the Key Parliamentary Democracies" href: https://dataverse.harvard.edu/dataset.xhtml?persistentId=doi:10.7910/DVN/L4OAKN - - text: "DEMINOVA LAB at Aarhus University" - href: https://projects.au.dk/deminova-lab/about-deminova + - text: "ParlEE: Sentence-level Speeches of Six EU Legislative Chambers" + href: https://pureportal.strath.ac.uk/en/datasets/parlee-plenary-speeches-v2-data-set-annotated-full-text-of-151-mi reference: - title: API Functions diff --git a/vignettes/get_parlquestions.Rmd b/vignettes/get_parlquestions.Rmd index 5599a653..e585bdae 100644 --- a/vignettes/get_parlquestions.Rmd +++ b/vignettes/get_parlquestions.Rmd @@ -21,7 +21,7 @@ assign("has_internet_via_proxy", TRUE, environment(curl::has_internet)) library(legisTaiwan) ``` -## Using `get_parlquestions()` as an Example to Parliarmentary Questions'. +## Fetching Parliarmentary Questions'. ```{r} library(legisTaiwan) From 074573891a0ebd4a0960bf588ca9cb7c997fa756 Mon Sep 17 00:00:00 2001 From: David Liao <35374714+davidycliao@users.noreply.github.com> Date: Sun, 17 Sep 2023 01:38:53 +0100 Subject: [PATCH 3/5] UPDATE v0.1.6 --- README.md | 4 ++++ _pkgdown.yml | 4 +--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 81755306..ae28ed31 100644 --- a/README.md +++ b/README.md @@ -39,6 +39,10 @@ library(legisTaiwan) #> ## legisTaiwan ## #> ## An R package connecting to the Taiwan Legislative API. ## ``` +--- + +
+ ## Caution: diff --git a/_pkgdown.yml b/_pkgdown.yml index 9abcfc91..cfb1cced 100644 --- a/_pkgdown.yml +++ b/_pkgdown.yml @@ -72,8 +72,6 @@ navbar: menu: - text: "Quick Start Guide" href: articles/quickstart.html#get-started-with-using-remotes - - text: "Tutorials" - href: articles/quickstart.html#quickstart.html#tutorials - text: "How to Contribute" href: articles/quickstart.html#quickstart.html#how-to-contribute @@ -97,7 +95,7 @@ navbar: - icon: fa-file-code-o text: Tutorial menu: - - text: "The Records of the Bills" + - text: "Records of the Bills" href: articles/get_bills.html - text: "Demographic Data" href: articles/get_legislators.html From e50b75dda69a2a0bcc09e2d27e2266c308808f77 Mon Sep 17 00:00:00 2001 From: David Liao <35374714+davidycliao@users.noreply.github.com> Date: Sun, 17 Sep 2023 01:43:04 +0100 Subject: [PATCH 4/5] Update r.yml --- .github/workflows/r.yml | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/.github/workflows/r.yml b/.github/workflows/r.yml index ef6a7852..dc78ec01 100644 --- a/.github/workflows/r.yml +++ b/.github/workflows/r.yml @@ -5,7 +5,6 @@ # # See https://github.com/r-lib/actions/tree/master/examples#readme for # additional example workflows available for the R community. - name: R on: @@ -23,15 +22,14 @@ jobs: strategy: matrix: r-version: ['3.6.3', '4.1.1'] - - steps: + steps: - uses: actions/checkout@v3 - uses: r-lib/actions/setup-pandoc@v2 - name: Set up R ${{ matrix.r-version }} uses: r-lib/actions/setup-r@f57f1301a053485946083d7a45022b278929a78a with: r-version: ${{ matrix.r-version }} - cran: https://cran-archive.r-project.org + cran: https://cran-archive.r-project.org # <--- Added this line - name: Install dependencies run: | install.packages(c("remotes", "rcmdcheck")) From 5b31cbb6bd760a2c2e5b1b8da03cb3d5104ff73b Mon Sep 17 00:00:00 2001 From: David Liao <35374714+davidycliao@users.noreply.github.com> Date: Sun, 17 Sep 2023 02:03:43 +0100 Subject: [PATCH 5/5] UPDATE v0.1.6 --- .github/workflows/lintr.yml | 55 ------------------------------------- README.md | 6 ++-- inst/README.Rmd | 4 +++ inst/README.md | 4 +++ vignettes/manual.Rmd | 2 +- 5 files changed, 12 insertions(+), 59 deletions(-) delete mode 100644 .github/workflows/lintr.yml diff --git a/.github/workflows/lintr.yml b/.github/workflows/lintr.yml deleted file mode 100644 index b912ba25..00000000 --- a/.github/workflows/lintr.yml +++ /dev/null @@ -1,55 +0,0 @@ -# This workflow uses actions that are not certified by GitHub. -# They are provided by a third-party and are governed by -# separate terms of service, privacy policy, and support -# documentation. -# lintr provides static code analysis for R. -# It checks for adherence to a given style, -# identifying syntax errors and possible semantic issues, -# then reports them to you so you can take action. -# More details at https://lintr.r-lib.org/ - -name: lintr - -on: - push: - branches: [ "master" ] - pull_request: - # The branches below must be a subset of the branches above - branches: [ "master" ] - schedule: - - cron: '42 11 * * 0' - -permissions: - contents: read - -jobs: - lintr: - name: Run lintr scanning - runs-on: ubuntu-latest - permissions: - contents: read # for checkout to fetch code - security-events: write # for github/codeql-action/upload-sarif to upload SARIF results - actions: read # only required for a private repository by github/codeql-action/upload-sarif to get the Action run status - - steps: - - name: Checkout code - uses: actions/checkout@v3 - - - name: Setup R - uses: r-lib/actions/setup-r@4e1feaf90520ec1215d1882fdddfe3411c08e492 - - - name: Setup lintr - uses: r-lib/actions/setup-r-dependencies@4e1feaf90520ec1215d1882fdddfe3411c08e492 - with: - extra-packages: lintr - - - name: Run lintr - run: lintr::sarif_output(lintr::lint_dir("."), "lintr-results.sarif") - shell: Rscript {0} - continue-on-error: true - - - name: Upload analysis results to GitHub - uses: github/codeql-action/upload-sarif@v2 - with: - sarif_file: lintr-results.sarif - wait-for-processing: true diff --git a/README.md b/README.md index ae28ed31..a26bfe02 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ -# Real-time and Archives of Taiwan Legislative Data in R +# Real-time and Archives of Taiwan Legislative Data in R @@ -39,10 +39,10 @@ library(legisTaiwan) #> ## legisTaiwan ## #> ## An R package connecting to the Taiwan Legislative API. ## ``` ---- -
+------------------------------------------------------------------------ +
## Caution: diff --git a/inst/README.Rmd b/inst/README.Rmd index da9a8b1a..ab3b564d 100644 --- a/inst/README.Rmd +++ b/inst/README.Rmd @@ -47,6 +47,10 @@ library(legisTaiwan) ``` +--- + +
+ ## Caution:
diff --git a/inst/README.md b/inst/README.md index e144b91a..a26bfe02 100644 --- a/inst/README.md +++ b/inst/README.md @@ -40,6 +40,10 @@ library(legisTaiwan) #> ## An R package connecting to the Taiwan Legislative API. ## ``` +------------------------------------------------------------------------ + +
+ ## Caution:
diff --git a/vignettes/manual.Rmd b/vignettes/manual.Rmd index 09b9440a..238ab42b 100644 --- a/vignettes/manual.Rmd +++ b/vignettes/manual.Rmd @@ -40,7 +40,7 @@ day. - [`get_executive_response()`](https://davidycliao.github.io/legisTaiwan/reference/get_executive_response.html): questions answered by the executives提供公報質詢事項行政院答復資訊 (自第8屆) -- [`get_public_debates()`+](https://davidycliao.github.io/legisTaiwan/reference/get_public_debates.html): public debates 提供公報之國是論壇資訊,並包含書面意見自 (自第8屆) +- [`get_public_debates()`](https://davidycliao.github.io/legisTaiwan/reference/get_public_debates.html): public debates 提供公報之國是論壇資訊,並包含書面意見自 (自第8屆) - [`get_speech_video()`](https://davidycliao.github.io/legisTaiwan/reference/get_speech_video.html): full video information of meetings and committees 提供立法院院會及委員會之委員發言片段相關影片資訊 (自第9屆)