Skip to content

Commit

Permalink
Merge pull request #20 from davidycliao/v0.1.6
Browse files Browse the repository at this point in the history
UPDATE v0.1.6
  • Loading branch information
davidycliao committed Sep 17, 2023
2 parents b267402 + 5b31cbb commit e361be5
Show file tree
Hide file tree
Showing 13 changed files with 140 additions and 103 deletions.
55 changes: 0 additions & 55 deletions .github/workflows/lintr.yml

This file was deleted.

6 changes: 2 additions & 4 deletions .github/workflows/r.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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"))
Expand Down
4 changes: 1 addition & 3 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -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")),
Expand Down Expand Up @@ -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/
Expand Down
42 changes: 38 additions & 4 deletions R/zzz.R
Original file line number Diff line number Diff line change
@@ -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)
}
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

<!-- README.md is generated from README.Rmd. Please edit that file -->

# Real-time and Archives of Taiwan Legislative Data in R <img src="man/figures/logo.png" align="right" width="180"/>
# Real-time and Archives of Taiwan Legislative Data in R <img src="../man/figures/logo.png" align="right" width="180"/>

<!-- badges: start -->

Expand Down Expand Up @@ -40,6 +40,10 @@ library(legisTaiwan)
#> ## An R package connecting to the Taiwan Legislative API. ##
```

------------------------------------------------------------------------

<br>

## Caution:

<div style="text-align: justify">
Expand Down
24 changes: 20 additions & 4 deletions _pkgdown.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -66,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

Expand All @@ -88,6 +92,18 @@ navbar:
- text: "Function Reference"
href: reference/index.html

- icon: fa-file-code-o
text: Tutorial
menu:
- text: "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:
Expand Down
11 changes: 4 additions & 7 deletions inst/README.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -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 <img src="../man/figures/logo.png" align="right" width="180"/>

<!-- badges: start -->
Expand Down Expand Up @@ -54,6 +47,10 @@ library(legisTaiwan)
```


---

<br>

## Caution:
<div style="text-align: justify">

Expand Down
60 changes: 60 additions & 0 deletions inst/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@

<!-- README.md is generated from README.Rmd. Please edit that file -->

# Real-time and Archives of Taiwan Legislative Data in R <img src="../man/figures/logo.png" align="right" width="180"/>

<!-- badges: start -->

[![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)
<!-- badges: end -->

<div style="text-align: justify">

`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.

</div>

<br>

## 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. ##
```

------------------------------------------------------------------------

<br>

## Caution:

<div style="text-align: justify">

`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.

</div>
4 changes: 2 additions & 2 deletions man/dot-onAttach.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions vignettes/get_legislators.Rmd
Original file line number Diff line number Diff line change
@@ -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}
---
Expand Down
6 changes: 3 additions & 3 deletions vignettes/get_parlquestions.Rmd
Original file line number Diff line number Diff line change
@@ -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}
---
Expand All @@ -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)
Expand Down
5 changes: 2 additions & 3 deletions vignettes/manual.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,7 @@ assign("has_internet_via_proxy", TRUE, environment(curl::has_internet))

<div style="text-align: justify">

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.

</div>
Expand All @@ -41,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屆)

Expand Down
16 changes: 1 addition & 15 deletions vignettes/quickstart.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ knitr::opts_chunk$set(
<div style="text-align: justify">

**`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.

</div>

Expand All @@ -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)


<br>

-----

## How to Contribute

<div style="text-align: justify">
Expand Down

0 comments on commit e361be5

Please sign in to comment.