diff --git a/.Rhistory b/.Rhistory
new file mode 100644
index 00000000..63d693cd
--- /dev/null
+++ b/.Rhistory
@@ -0,0 +1,512 @@
+limit = 5
+)
+# Check empty structure
+expect_equal(nrow(result$bills), 0)
+expect_equal(result$metadata$total, 0)
+})
+bills <- get_ly_legislator_bills(
+term = 9,
+name = "王金平",
+limit = 5
+)
+if(nrow(bills$bills) > 0) {
+# Check content validity
+expect_true(all(!is.na(bills$bills$billNo)))
+expect_true(all(!is.na(bills$bills$議案名稱)))
+expect_true(all(!is.na(bills$bills$屆期)))
+expect_true(all(bills$bills$屆期 == 9)) # Should match requested term
+}
+# Test error handling
+test_that("get_ly_legislator_bills handles errors properly", {
+# Test non-existent term/name combination
+expect_error(
+get_ly_legislator_bills(
+term = 999,
+name = "不存在的立委"
+)
+)
+# Test invalid page number
+expect_error(
+get_ly_legislator_bills(
+term = 9,
+name = "王金平",
+page = -1
+)
+)
+# Test invalid limit
+expect_error(
+get_ly_legislator_bills(
+term = 9,
+name = "王金平",
+limit = 0
+)
+)
+})
+# Test error handling
+test_that("get_ly_legislator_bills handles errors properly", {
+# Test non-existent term/name combination
+expect_error(
+get_ly_legislator_bills(
+term = 999,
+name = "不存在的立委"
+)
+)
+# Test invalid page number
+expect_error(
+get_ly_legislator_bills(
+term = 9,
+name = "王金平",
+page = -1
+)
+)
+})
+get_tly_stat()
+library(legisTaiwan)
+ly_info <- get_tly_stat()
+library(legisTaiwan)
+ly_info <- get_tly_stat()
+ly_info
+ly_info$meet$terms
+print(ly_info$meet$terms, type = "html")
+ly_info$bill$total
+ly_info$bill
+ly_info$bill$terms
+ly_info$legislator$terms
+ly_info$gazette$yearly_stats
+ly_info$gazette$agenda_total
+ly_info$meet$terms
+ly_info$ivod$terms
+ly_info$bill$terms
+ly_info$meet$total
+get_tly_stat()
+roxygen2::roxygenise()
+roxygen2::roxygenise()
+roxygen2::roxygenise()
+committees <- get_ly_committees_type(
+type = "常設委員會"
+)
+committee <- get_ly_committees_type(
+code = 15
+)
+committee
+committee <- get_ly_committees_type(
+)
+roxygen2::roxygenise()
+esult <- get_ly_committee_meets(committee_id = 22)
+roxygen2::roxygenise()
+esult <- get_ly_committee_meets(committee_id = 22)
+page2_videos <- get_ly_ivod(
+term = 9,
+session_period = 1,
+page = 2,
+limit = 20
+)
+roxygen2::roxygenise()
+esult <- get_ly_committee_meets(committee_id = 22)
+# 取得第九屆第一會期的影片
+videos <- get_ly_ivod(
+term = 9,
+session_period = 1,
+limit = 5
+)
+roxygen2::roxygenise()
+roxygen2::roxygenise()
+roxygen2::roxygenise()
+file.edit("~/.Rprofile")
+roxygen2::roxygenise()
+stats <- get_tly_stat()
+# 案例一:基本統計資訊分析
+library(dplyr)
+library(ggplot2)
+# 取得立法院統計資料
+stats <- get_tly_stat()
+# 1. 分析各屆期法案統計
+analyze_bills <- function(stats) {
+# 計算各屆期法案數量和比例
+bill_stats <- stats$bill$terms %>%
+mutate(
+percentage = round(count / sum(count) * 100, 2),
+cumulative = cumsum(count)
+)
+# 繪製法案數量趨勢圖
+ggplot(bill_stats, aes(x = term, y = count)) +
+geom_line(color = "blue") +
+geom_point(color = "red") +
+labs(
+title = "各屆期法案數量趨勢",
+x = "屆期",
+y = "法案數量"
+) +
+theme_minimal()
+# 輸出統計摘要
+cat("\n=== 法案統計摘要 ===\n")
+cat(sprintf("總法案數:%d\n", stats$bill$total))
+cat(sprintf("最後更新時間:%s\n", format(stats$bill$max_update_time)))
+cat("\n前五屆法案數量:\n")
+print(head(bill_stats, 5))
+}
+# 2. 分析會議資訊
+analyze_meetings <- function(stats) {
+# 整理會議資料
+meeting_stats <- stats$meet$terms %>%
+mutate(
+議事錄比例 = round(議事錄_count / count * 100, 2),
+最後會議日期 = format(max_meeting_date, "%Y-%m-%d")
+)
+# 繪製會議記錄完整性分析圖
+ggplot(meeting_stats, aes(x = term)) +
+geom_bar(aes(y = count), stat = "identity", fill = "blue", alpha = 0.5) +
+geom_bar(aes(y = 議事錄_count), stat = "identity", fill = "red", alpha = 0.5) +
+labs(
+title = "各屆期會議記錄完整性分析",
+x = "屆期",
+y = "數量"
+) +
+theme_minimal()
+# 輸出統計摘要
+cat("\n=== 會議統計摘要 ===\n")
+cat(sprintf("總會議數:%d\n", stats$meet$total))
+cat("\n各屆期會議記錄統計:\n")
+print(head(meeting_stats, 5))
+}
+# 3. 分析影片資料
+analyze_ivod <- function(stats) {
+# 整理影片資料
+ivod_stats <- stats$ivod$terms %>%
+mutate(
+開始日期 = format(start_date, "%Y-%m-%d"),
+結束日期 = format(end_date, "%Y-%m-%d"),
+期間天數 = as.numeric(difftime(end_date, start_date, units = "days")),
+平均每日影片數 = round(count / 期間天數, 2)
+)
+# 繪製影片數量分布圖
+ggplot(ivod_stats, aes(x = term, y = count)) +
+geom_bar(stat = "identity", fill = "darkgreen") +
+labs(
+title = "各屆期影片記錄數量",
+x = "屆期",
+y = "影片數量"
+) +
+theme_minimal()
+# 輸出統計摘要
+cat("\n=== 影片統計摘要 ===\n")
+cat(sprintf("總影片數:%d\n", stats$ivod$total))
+cat(sprintf("資料期間:%s 至 %s\n",
+format(stats$ivod$date_range$start, "%Y-%m-%d"),
+format(stats$ivod$date_range$end, "%Y-%m-%d")))
+cat("\n各屆期影片統計:\n")
+print(head(ivod_stats, 5))
+}
+# 4. 整合分析報告
+generate_report <- function(stats) {
+cat("\n==========================================")
+cat("\n 立法院資料統計分析報告")
+cat("\n==========================================\n")
+# 1. 法案統計
+cat("\nI. 法案統計")
+cat("\n------------------------------------------")
+cat(sprintf("\n總法案數:%d", stats$bill$total))
+cat(sprintf("\n最新法案更新:%s", format(stats$bill$max_update_time, "%Y-%m-%d")))
+# 2. 委員統計
+cat("\n\nII. 委員統計")
+cat("\n------------------------------------------")
+cat(sprintf("\n歷史委員總數:%d", stats$legislator$total))
+cat("\n各屆期委員人數:")
+print(head(stats$legislator$terms, 5))
+# 3. 公報統計
+cat("\nIII. 公報統計")
+cat("\n------------------------------------------")
+cat(sprintf("\n公報總數:%d", stats$gazette$total))
+cat(sprintf("\n議程總數:%d", stats$gazette$agenda_total))
+cat(sprintf("\n最後會議日期:%s", format(stats$gazette$last_meeting, "%Y-%m-%d")))
+# 4. 影片統計
+cat("\n\nIV. 影片統計")
+cat("\n------------------------------------------")
+cat(sprintf("\n影片總數:%d", stats$ivod$total))
+cat(sprintf("\n影片記錄期間:%s 至 %s",
+format(stats$ivod$date_range$start, "%Y-%m-%d"),
+format(stats$ivod$date_range$end, "%Y-%m-%d")))
+cat("\n\n==========================================\n")
+}
+# 使用範例:
+# 1. 執行基本分析
+stats <- get_tly_stat()
+analyze_bills(stats)
+analyze_meetings(stats)
+analyze_ivod(stats)
+# 2. 產生完整報告
+generate_report(stats)
+# 3. 特定分析:計算每屆期的法案通過率趨勢
+calculate_bill_trends <- function(stats) {
+bill_trends <- stats$bill$terms %>%
+left_join(stats$meet$terms, by = "term") %>%
+mutate(
+bills_per_meeting = round(count.x / count.y, 2),
+bills_per_day = round(count.x / as.numeric(difftime(max_meeting_date,
+lag(max_meeting_date), units = "days")), 2)
+) %>%
+select(term, count.x, count.y, bills_per_meeting, bills_per_day) %>%
+rename(
+bills = count.x,
+meetings = count.y
+)
+print(bill_trends)
+return(bill_trends)
+}
+# 4. 繪製互動式視覺化(需要安裝 plotly 套件)
+library(plotly)
+create_interactive_plot <- function(stats) {
+bill_data <- stats$bill$terms
+p <- plot_ly(bill_data, x = ~term, y = ~count, type = "scatter", mode = "lines+markers",
+text = ~paste("屆期:", term, "
法案數:", count),
+hoverinfo = "text") %>%
+layout(title = "各屆期法案數量趨勢",
+xaxis = list(title = "屆期"),
+yaxis = list(title = "法案數量"))
+return(p)
+}
+install.packages(c("dplyr", "ggplot2", "plotly", "lubridate"))
+stats <- get_tly_stat()
+analyze_bills(stats)
+analyze_meetings(stats)
+analyze_ivod(stats)
+analyze_ivod(stats)
+analyze_meetings(stats)
+calculate_bill_trends <- function(stats) {
+bill_trends <- stats$bill$terms %>%
+left_join(stats$meet$terms, by = "term") %>%
+mutate(
+bills_per_meeting = round(count.x / count.y, 2),
+bills_per_day = round(count.x / as.numeric(difftime(max_meeting_date,
+lag(max_meeting_date), units = "days")), 2)
+) %>%
+select(term, count.x, count.y, bills_per_meeting, bills_per_day) %>%
+rename(
+bills = count.x,
+meetings = count.y
+)
+print(bill_trends)
+return(bill_trends)
+}
+calculate_bill_trends()
+calculate_bill_trends(stats)
+create_interactive_plot(stats )
+calculate_bill_trends(stats)
+stats
+# 2. Meeting information analysis
+analyze_meetings <- function(stats) {
+# Process meeting data
+meeting_stats <- stats$meet$terms %>%
+mutate(
+minutes_ratio = round(議事錄_count / count * 100, 2),
+last_meeting_date = format(max_meeting_date, "%Y-%m-%d")
+)
+# Create meeting records completeness analysis plot
+ggplot(meeting_stats, aes(x = term)) +
+geom_bar(aes(y = count), stat = "identity", fill = "blue", alpha = 0.5) +
+geom_bar(aes(y = 議事錄_count), stat = "identity", fill = "red", alpha = 0.5) +
+labs(
+title = "Meeting Records Completeness by Term",
+x = "Term",
+y = "Count"
+) +
+theme_minimal()
+# Output statistical summary
+cat("\n=== Meeting Statistics Summary ===\n")
+cat(sprintf("Total Meetings: %d\n", stats$meet$total))
+cat("\nMeeting Records Statistics by Term:\n")
+print(head(meeting_stats, 5))
+}
+# 3. Video data analysis
+analyze_ivod <- function(stats) {
+# Process video data
+ivod_stats <- stats$ivod$terms %>%
+mutate(
+start_date_fmt = format(start_date, "%Y-%m-%d"),
+end_date_fmt = format(end_date, "%Y-%m-%d"),
+period_days = as.numeric(difftime(end_date, start_date, units = "days")),
+avg_daily_videos = round(count / period_days, 2)
+)
+# Create video count distribution plot
+ggplot(ivod_stats, aes(x = term, y = count)) +
+geom_bar(stat = "identity", fill = "darkgreen") +
+labs(
+title = "Video Records Count by Term",
+x = "Term",
+y = "Number of Videos"
+) +
+theme_minimal()
+# Output statistical summary
+cat("\n=== Video Statistics Summary ===\n")
+cat(sprintf("Total Videos: %d\n", stats$ivod$total))
+cat(sprintf("Data Period: %s to %s\n",
+format(stats$ivod$date_range$start, "%Y-%m-%d"),
+format(stats$ivod$date_range$end, "%Y-%m-%d")))
+cat("\nVideo Statistics by Term:\n")
+print(head(ivod_stats, 5))
+}
+# 4. Integrated analysis report
+generate_report <- function(stats) {
+cat("\n==========================================")
+cat("\n Legislative Yuan Data Analysis Report")
+cat("\n==========================================\n")
+# 1. Bill statistics
+cat("\nI. Bill Statistics")
+cat("\n------------------------------------------")
+cat(sprintf("\nTotal Bills: %d", stats$bill$total))
+cat(sprintf("\nLast Bill Update: %s", format(stats$bill$max_update_time, "%Y-%m-%d")))
+# 2. Legislator statistics
+cat("\n\nII. Legislator Statistics")
+cat("\n------------------------------------------")
+cat(sprintf("\nHistorical Total Legislators: %d", stats$legislator$total))
+cat("\nLegislators by Term:")
+print(head(stats$legislator$terms, 5))
+# 3. Gazette statistics
+cat("\nIII. Gazette Statistics")
+cat("\n------------------------------------------")
+cat(sprintf("\nTotal Gazettes: %d", stats$gazette$total))
+cat(sprintf("\nTotal Agendas: %d", stats$gazette$agenda_total))
+cat(sprintf("\nLast Meeting Date: %s", format(stats$gazette$last_meeting, "%Y-%m-%d")))
+# 4. Video statistics
+cat("\n\nIV. Video Statistics")
+cat("\n------------------------------------------")
+cat(sprintf("\nTotal Videos: %d", stats$ivod$total))
+cat(sprintf("\nVideo Recording Period: %s to %s",
+format(stats$ivod$date_range$start, "%Y-%m-%d"),
+format(stats$ivod$date_range$end, "%Y-%m-%d")))
+cat("\n\n==========================================\n")
+}
+# 2. Meeting information analysis
+analyze_meetings <- function(stats) {
+# Process meeting data
+meeting_stats <- stats$meet$terms %>%
+mutate(
+minutes_ratio = round(議事錄_count / count * 100, 2),
+last_meeting_date = format(max_meeting_date, "%Y-%m-%d")
+)
+# Create meeting records completeness analysis plot
+ggplot(meeting_stats, aes(x = term)) +
+geom_bar(aes(y = count), stat = "identity", fill = "blue", alpha = 0.5) +
+geom_bar(aes(y = 議事錄_count), stat = "identity", fill = "red", alpha = 0.5) +
+labs(
+title = "Meeting Records Completeness by Term",
+x = "Term",
+y = "Count"
+) +
+theme_minimal()
+# Output statistical summary
+cat("\n=== Meeting Statistics Summary ===\n")
+cat(sprintf("Total Meetings: %d\n", stats$meet$total))
+cat("\nMeeting Records Statistics by Term:\n")
+print(head(meeting_stats, 5))
+}
+analyze_meetings(stats)
+# Process meeting data
+meeting_stats <- stats$meet$terms %>%
+mutate(
+minutes_ratio = round(議事錄_count / count * 100, 2),
+last_meeting_date = format(max_meeting_date, "%Y-%m-%d")
+)
+meeting_stats
+ggplot(meeting_stats, aes(x = term)) +
+geom_bar(aes(y = count), stat = "identity", fill = "blue", alpha = 0.5) +
+geom_bar(aes(y = 議事錄_count), stat = "identity", fill = "red", alpha = 0.5) +
+labs(
+title = "Meeting Records Completeness by Term",
+x = "Term",
+y = "Count"
+) +
+theme_minimal()
+ggplot(meeting_stats, aes(x = term)) +
+geom_bar(aes(y = count), stat = "identity", fill = "blue", alpha = 0.5)
+# Create meeting records completeness analysis plot
+ggplot(meeting_stats, aes(x = term)) +
+geom_bar(aes(y = count), stat = "identity", fill = "blue", alpha = 0.5) +
+geom_bar(aes(y = 議事錄_count), stat = "identity", fill = "red", alpha = 0.5) +
+labs(
+title = "Meeting Records Completeness by Term",
+x = "Term",
+y = "Count"
+) +
+theme_minimal()
+# Create meeting records completeness analysis plot
+ggplot(meeting_stats, aes(x = term)) +
+geom_bar(aes(y = count), stat = "identity", fill = "blue", alpha = 0.5) +
+geom_bar(aes(y = `議事錄_count`), stat = "identity", fill = "red", alpha = 0.5) +
+labs(
+title = "Meeting Records Completeness by Term",
+x = "Term",
+y = "Count"
+) +
+theme_minimal()
+# Create meeting records completeness analysis plot
+x <- ggplot(meeting_stats, aes(x = term)) +
+geom_bar(aes(y = count), stat = "identity", fill = "blue", alpha = 0.5) +
+geom_bar(aes(y = `議事錄_count`), stat = "identity", fill = "red", alpha = 0.5) +
+labs(
+title = "Meeting Records Completeness by Term",
+x = "Term",
+y = "Count"
+) +
+theme_minimal()
+x
+# Create meeting records completeness analysis plot
+ggplot(meeting_stats, aes(x = term)) +
+geom_bar(aes(y = count), stat = "identity", fill = "blue", alpha = 0.5) +
+geom_bar(aes(y = `議事錄_count`), stat = "identity", fill = "red", alpha = 0.5) +
+labs(
+title = "Meeting Records Completeness by Term",
+x = "Term",
+y = "Count"
+) +
+theme_minimal()
+stats <- get_tly_stat()
+stats
+stats$bill$terms
+roxygen2::roxygenise()
+roxygen2::roxygenise()
+roxygen2::roxygenise()
+roxygen2::roxygenise()
+roxygen2::roxygenise()
+roxygen2::roxygenise()
+roxygen2::roxygenise()
+stats <- get_tly_stat()
+analyze_bills(stats)
+analyze_bills
+analyze_bills(stats)
+analyze_meetings(stats)
+analyze_ivod(stats)
+create_interactive_plot(stats)
+library(pkgdown)
+build_site()
+build_site()
+build_site()
+build_site()
+build_site()
+deploy_to_branch()
+roxygen2::roxygenise()
+roxygen2::roxygenise()
+roxygen2::roxygenise()
+roxygen2::roxygenise()
+roxygen2::roxygenise()
+library(legisTaiwan)
+devtools::check(args = c('--no-codoc', '--no-manual', '--no-check-ASCII'))
+library(stringi)
+# 读取文件内容
+file_content <- readLines("R/bill.R", encoding = "UTF-8")
+file_content
+writeLines(file_content, "R/bill.R", useBytes = TRUE)
+roxygen2::roxygenise()
+roxygen2::roxygenise()
+roxygen2::roxygenise()
+roxygen2::roxygenise()
+roxygen2::roxygenise()
+roxygen2::roxygenise()
+roxygen2::roxygenise()
+roxygen2::roxygenise()
+roxygen2::roxygenise()
+roxygen2::roxygenise()
+build_site()
+roxygen2::roxygenise()
+build_site()
+deploy_to_branch()
diff --git a/.Rproj.user/763C8F27/rmd-outputs b/.Rproj.user/763C8F27/rmd-outputs
index 730fe4df..8254c526 100644
--- a/.Rproj.user/763C8F27/rmd-outputs
+++ b/.Rproj.user/763C8F27/rmd-outputs
@@ -1,8 +1,10 @@
-/private/var/folders/60/xlhp81vn4_79cp2dbjgy07tm0000gn/T/RtmpCIuZHQ/preview-ad82452287cf.html
-/private/var/folders/60/xlhp81vn4_79cp2dbjgy07tm0000gn/T/RtmpCIuZHQ/preview-adc04d1fddf6.html
-/private/var/folders/60/xlhp81vn4_79cp2dbjgy07tm0000gn/T/RtmpCIuZHQ/preview-adf9227c788.html
+/private/var/folders/60/xlhp81vn4_79cp2dbjgy07tm0000gn/T/RtmpnIcpqT/preview-b0a385c2b7c.html
+/private/var/folders/60/xlhp81vn4_79cp2dbjgy07tm0000gn/T/RtmpnIcpqT/preview-184ca1df407aa.dir/quickstart.html
+/private/var/folders/60/xlhp81vn4_79cp2dbjgy07tm0000gn/T/RtmpnIcpqT/preview-184ca2a28b82f.dir/quickstart.html
+/private/var/folders/60/xlhp81vn4_79cp2dbjgy07tm0000gn/T/RtmpnIcpqT/preview-184ca1b7bd20.dir/quickstart.html
+/private/var/folders/60/xlhp81vn4_79cp2dbjgy07tm0000gn/T/RtmpnIcpqT/preview-3a97368633ab.html
+
-/private/var/folders/60/xlhp81vn4_79cp2dbjgy07tm0000gn/T/RtmpUI0uD5/preview-b4ce3dbbc034.dir/get_bills.html
diff --git a/.Rproj.user/763C8F27/sources/prop/5CAD1E2F b/.Rproj.user/763C8F27/sources/prop/5CAD1E2F
index f25a0fcd..3e9afadf 100644
--- a/.Rproj.user/763C8F27/sources/prop/5CAD1E2F
+++ b/.Rproj.user/763C8F27/sources/prop/5CAD1E2F
@@ -2,5 +2,5 @@
"source_window_id": "",
"Source": "Source",
"cursorPosition": "102,43",
- "scrollLine": "96"
+ "scrollLine": "0"
}
\ No newline at end of file
diff --git a/.Rproj.user/763C8F27/sources/prop/C134E6FE b/.Rproj.user/763C8F27/sources/prop/C134E6FE
index 0d242741..a0dba796 100644
--- a/.Rproj.user/763C8F27/sources/prop/C134E6FE
+++ b/.Rproj.user/763C8F27/sources/prop/C134E6FE
@@ -2,5 +2,5 @@
"source_window_id": "",
"Source": "Source",
"cursorPosition": "97,0",
- "scrollLine": "55"
+ "scrollLine": "0"
}
\ No newline at end of file
diff --git a/.Rproj.user/763C8F27/sources/prop/C7EAE541 b/.Rproj.user/763C8F27/sources/prop/C7EAE541
index 0347cbb1..dff798b3 100644
--- a/.Rproj.user/763C8F27/sources/prop/C7EAE541
+++ b/.Rproj.user/763C8F27/sources/prop/C7EAE541
@@ -1,8 +1,8 @@
{
"source_window_id": "",
"Source": "Source",
- "cursorPosition": "81,4",
- "scrollLine": "70",
+ "cursorPosition": "90,20",
+ "scrollLine": "61",
"rmdVisualMode": "false",
"rmdVisualCollapsedChunks": "",
"rmdVisualModeLocation": "2:0"
diff --git a/.Rproj.user/763C8F27/sources/session-ab45fd2f/01697494-contents b/.Rproj.user/763C8F27/sources/session-ab45fd2f/01697494-contents
deleted file mode 100644
index cc58b737..00000000
--- a/.Rproj.user/763C8F27/sources/session-ab45fd2f/01697494-contents
+++ /dev/null
@@ -1,11 +0,0 @@
-^renv$
-^renv\.lock$
-^.*\.Rproj$
-^\.Rproj\.user$
-^\.github$
-^_pkgdown\.yml$
-^docs$
-^pkgdown$
-^doc$
-^Meta$
-^README\.Rmd$
diff --git a/.Rproj.user/763C8F27/sources/session-ab45fd2f/0706C9B6-contents b/.Rproj.user/763C8F27/sources/session-ab45fd2f/0706C9B6-contents
deleted file mode 100644
index 13d0c1c7..00000000
--- a/.Rproj.user/763C8F27/sources/session-ab45fd2f/0706C9B6-contents
+++ /dev/null
@@ -1,902 +0,0 @@
-#'@title The Spoken Meeting Records 委員發言
-#'
-#'@author David Liao (davidycliao@@gmail.com)
-#'
-#'@param start_date numeric Must be formatted in Minguo (Taiwan) calendar, e.g. 1090101.
-#'
-#'@param end_date numeric Must be formatted in Minguo (Taiwan) calendar, e.g. 1090102.
-#'
-#'@param meeting_unit NULL The default is NULL, which includes all meeting types
-#' between the starting date and the ending date.
-#'
-#'@param verbose logical, indicates whether `get_meetings` should print out
-#'detailed output when retrieving the data.
-#'
-#'@return list, which contains: \describe{
-#' \item{`title`}{the spoken meeting records }
-#' \item{`query_time`}{the query time}
-#' \item{`retrieved_number`}{the number of the observation}
-#' \item{`meeting_unit`}{the meeting unit}
-#' \item{`start_date_ad`}{the start date in POSIXct}
-#' \item{`end_date_ad`}{the end date in POSIXct}
-#' \item{`start_date`}{the start date in ROC Taiwan calendar}
-#' \item{`url`}{the retrieved json url}
-#' \item{`variable_names`}{the variables of the tibble dataframe}
-#' \item{`manual_info`}{the offical manual, \url{https://www.ly.gov.tw/Pages/List.aspx?nodeid=154}; or use get_variable_info("get_meetings")}
-#' \item{`data`}{a tibble dataframe, whose variables include:
-#' \describe{\item{`smeeting_date`}{會議日期}
-#' \item{`meeting_status`}{會議狀態}
-#' \item{`meeting_name`}{會議名稱}
-#' \item{`meeting_content`}{會議事由}
-#' \item{`speechers`}{委員發言名單}
-#' \item{`meeting_unit`}{主辦單位}
-#' \item{`date_ad`}{西元年}
-#' }
-#' }
-#' }
-#'
-#'@importFrom attempt stop_if_all
-#'@importFrom jsonlite fromJSON
-#'@importFrom withr with_options
-#'
-#'@export
-#'
-#'@examples
-#' ## query meeting records by a period of the dates in Minguo (Taiwan) calendar
-#' ## 輸入「中華民國民年」下載「委員發言」
-#'get_meetings(start_date = "1050120", end_date = "1050210")
-#'
-#' ## query meeting records by a period of the dates in Minguo (Taiwan) calendar format
-#' ## and a meeting
-#' ## 輸入「中華民國民年」與「審查會議或委員會名稱」下載會議審查資訊
-#'get_meetings(start_date = 1060120, end_date = 1070310, meeting_unit = "內政委員會")
-#'
-#'@details `get_meetings` produces a list, which contains `title`, `query_time`,
-#'`retrieved_number`, `meeting_unit`, `start_date_ad`, `end_date_ad`, `start_date`,
-#'`end_date`, `url`, `variable_names`, `manual_info` and `data`.
-#'
-#'@note To retrieve the user manual and more information about variable of the data
-#'frame, please use `get_variable_info("get_meetings")` or visit
-#'the API manual at \url{https://www.ly.gov.tw/Pages/List.aspx?nodeid=154}.
-#'資料似乎不一致,待確認。委員發言(取得最早時間不詳,待檢查。)
-#'
-#'@seealso
-#'`get_variable_info("get_meetings")`
-#'
-#'@seealso
-#' Regarding Minguo calendar, please see \url{https://en.wikipedia.org/wiki/Republic_of_China_calendar}.
-
-get_meetings <- function(start_date = NULL, end_date = NULL, meeting_unit = NULL,
- verbose = TRUE) {
- check_internet()
- api_check(start_date = check_date(start_date), end_date = check_date(end_date))
- set_api_url <- paste("https://www.ly.gov.tw/WebAPI/LegislativeSpeech.aspx?from=",
- start_date, "&to=", end_date, "&meeting_unit=", meeting_unit, "&mode=json", sep = "")
- tryCatch(
- {
- with_options(list(timeout = max(1000, getOption("timeout"))),{json_df <- jsonlite::fromJSON(set_api_url)})
- df <- tibble::as_tibble(json_df)
- attempt::stop_if_all(nrow(df) == 0, isTRUE, msg = "The query is unavailable.")
- df["date_ad"] <- do.call("c", lapply(df$smeeting_date, transformed_date_meeting))
- if (isTRUE(verbose)) {
- cat(" Retrieved URL: \n", set_api_url, "\n")
- cat(" Retrieved via :", meeting_unit, "\n")
- cat(" Retrieved date between:", as.character(check_date(start_date)), "and", as.character(check_date(end_date)), "\n")
- cat(" Retrieved number:", nrow(df), "\n")
- }
- list_data <- list("title" = "the spoken meeting records",
- "query_time" = Sys.time(),
- "retrieved_number" = nrow(df),
- "meeting_unit" = meeting_unit,
- "start_date_ad" = check_date(start_date),
- "end_date_ad" = check_date(end_date),
- "start_date" = start_date,
- "end_date" = end_date,
- "url" = set_api_url,
- "variable_names" = colnames(df),
- "manual_info" = "https://www.ly.gov.tw/Pages/List.aspx?nodeid=154",
- "data" = df)
- return(list_data)
- },
- error = function(error_message) {
- message(error_message)
- }
- )
-}
-
-
-#'@title The Meeting Records of Cross-caucus Session 黨團協商資訊
-#'
-#'@author David Liao (davidycliao@@gmail.com)
-#'
-#'@param start_date character Must be formatted in Minguo (ROC) calendar with three
-#'forward slashes between year, month and day, e.g. "106/10/20".
-#'
-#'@param end_date character Must be formatted in Minguo (ROC) calendar with three
-#'forward slashes between year, month and day, e.g. "109/01/10".
-#'
-#'@param verbose logical, indicates whether `get_caucus_meetings` should print out
-#'detailed output when retrieving the data.
-#'
-#'@return list, which contains: \describe{
-#' \item{`title`}{the meeting records of cross-caucus session}
-#' \item{`query_time`}{the query time}
-#' \item{`retrieved_number`}{the number of observation}
-#' \item{`meeting_unit`}{the meeting unit}
-#' \item{`start_date_ad`}{the start date in POSIXct}
-#' \item{`end_date_ad`}{the end date in POSIXct}
-#' \item{`start_date`}{the start date in ROC Taiwan calendar}
-#' \item{`url`}{the retrieved json url}
-#' \item{`variable_names`}{the variables of the tibble dataframe}
-#' \item{`manual_info`}{the official manual, \url{https://data.ly.gov.tw/getds.action?id=8}; or use get_variable_info("get_caucus_meetings")}
-#' \item{`data`}{a tibble dataframe, whose variables include:
-#' \describe{\item{`comYear`}{卷}
-#' \item{`comVolume`}{期}
-#' \item{`comBookId`}{冊別}
-#' \item{`term`}{屆別}
-#' \item{`sessionPeriod`}{會期}
-#' \item{`meetingTimes`}{臨時會會次}
-#' \item{`meetingDate`}{會議日期(民國年)}
-#' \item{`meetingName`}{會議名稱}
-#' \item{`subject`}{案由}
-#' \item{`pageStart`}{起始頁}
-#' \item{`pageEnd`}{結束頁}
-#' \item{`docUrl`}{檔案下載位置}
-#' \item{`htmlUrl`}{html網址}
-#' \item{`selectTerm`}{屆別期別篩選條件}
-#' }
-#' }
-#' }
-#'
-#'@importFrom attempt stop_if_all
-#'@importFrom jsonlite fromJSON
-#'@importFrom withr with_options
-#'
-#'@export
-#'
-#'@examples
-#' ## query the meeting records of cross-caucus session using a period of
-#' ## the dates in Taiwan ROC calender format with forward slash (/).
-#' ## 輸入「中華民國民年」下載「黨團協商」,輸入時間請依照該格式 "106/10/20",
-#' ## 需有「正斜線」做隔開。
-#'get_caucus_meetings(start_date = "106/10/20", end_date = "107/03/10")
-#'
-#'@details `get_caucus_meetings` produces a list, which contains `title`, `query_time`,
-#'`retrieved_number`, `meeting_unit`, `start_date_ad`, `end_date_ad`, `start_date`,
-#'`end_date`, `url`, `variable_names`, `manual_info` and `data.`
-#'\\ifelse{html}{\\href{https://lifecycle.r-lib.org/articles/stages.html#experimental}{\\figure{lifecycle-experimental.svg}{options: alt='[Experimental]'}}}{\\strong{[Experimental]}}
-#'
-#'@note To retrieve the user manual and more information about variable of the data
-#' frame, please use `get_variable_info("get_caucus_meetings")`
-#' or visit the API manual at \url{https://data.ly.gov.tw/getds.action?id=8}.
-#' 議事類:提供公報之黨團協商資訊 (自第8屆第1會期起)
-#'
-#'@seealso
-#'`get_variable_info("get_caucus_meetings")`
-#'
-#'@seealso
-#' Regarding Minguo calendar, please see \url{https://en.wikipedia.org/wiki/Republic_of_China_calendar}.
-#
-# get_caucus_meetings <- function(start_date = NULL, end_date = NULL,
-# verbose = TRUE) {
-# check_internet()
-# api_check(start_date = transformed_date_meeting(start_date),
-# end_date = transformed_date_meeting(end_date))
-# set_api_url <- paste("https://data.ly.gov.tw/odw/ID8Action.action?comYear=&comVolume=&comBookId=&term=&sessionPeriod=&sessionTimes=&meetingTimes=&meetingDateS=",
-# start_date, "&meetingDateE=", end_date, "&fileType=json", sep = "")
-# tryCatch(
-# {
-# with_options(list(timeout = max(1000, getOption("timeout"))),{json_df <- jsonlite::fromJSON(set_api_url)})
-# df <- tibble::as_tibble(json_df$dataList)
-# attempt::stop_if_all(nrow(df) == 0, isTRUE, msg = "The query is unavailable.")
-# if (isTRUE(verbose)) {
-# cat(" Retrieved URL: \n", set_api_url, "\n")
-# cat(" Retrieved date between:", as.character(transformed_date_meeting(start_date)), "and", as.character(transformed_date_meeting(end_date)), "\n")
-# cat(" Retrieved number:", nrow(df), "\n")
-# }
-# list_data <- list("title" = "the meeting records of cross-caucus session",
-# "query_time" = Sys.time(),
-# "retrieved_number" = nrow(df),
-# "start_date_ad" = transformed_date_meeting(start_date),
-# "end_date_ad" = transformed_date_meeting(end_date),
-# "start_date" = start_date,
-# "end_date" = end_date,
-# "url" = set_api_url,
-# "variable_names" = colnames(df),
-# "manual_info" = "https://data.ly.gov.tw/getds.action?id=8",
-# "data" = df)
-# return(list_data)
-# },
-# error = function(error_message) {
-# message(error_message)
-# }
-# )
-# }
-get_caucus_meetings <- function(start_date = NULL, end_date = NULL,
- verbose = TRUE) {
- # 檢查日期格式
- date_format_check <- function(date) {
- if (!is.null(date) && !grepl("^\\d{3}/\\d{2}/\\d{2}$", date)) {
- stop(paste("Invalid date format:", date, "\n",
- "Please use the format 'YYY/MM/DD' (ROC calendar),\n",
- "For example: '106/10/20'\n",
- "Where YYY is the ROC year (民國年)"))
- }
- }
-
- check_internet()
-
- # 檢查開始和結束日期
- date_format_check(start_date)
- date_format_check(end_date)
-
- if(isTRUE(verbose)) {
- cat("Downloading caucus meetings data...\n")
- pb <- txtProgressBar(min = 0, max = 100, style = 3)
- }
-
- # Update progress bar to 20%
- if(isTRUE(verbose)) setTxtProgressBar(pb, 20)
-
- api_check(start_date = transformed_date_meeting(start_date),
- end_date = transformed_date_meeting(end_date))
-
- # Update progress bar to 40%
- if(isTRUE(verbose)) setTxtProgressBar(pb, 40)
-
- set_api_url <- paste("https://data.ly.gov.tw/odw/ID8Action.action?comYear=&comVolume=&comBookId=&term=&sessionPeriod=&sessionTimes=&meetingTimes=&meetingDateS=",
- start_date, "&meetingDateE=", end_date, "&fileType=json", sep = "")
-
- tryCatch(
- {
- # Update progress bar to 60%
- if(isTRUE(verbose)) setTxtProgressBar(pb, 60)
-
- with_options(list(timeout = max(1000, getOption("timeout"))),{
- json_df <- jsonlite::fromJSON(set_api_url)
- })
-
- # Update progress bar to 80%
- if(isTRUE(verbose)) setTxtProgressBar(pb, 80)
-
- df <- tibble::as_tibble(json_df$dataList)
- attempt::stop_if_all(nrow(df) == 0, isTRUE, msg = "The query is unavailable.")
-
- # Update progress bar to 100% and close it
- if(isTRUE(verbose)) {
- setTxtProgressBar(pb, 100)
- close(pb)
- cat("\n\n") # Add newlines after progress bar
- cat("====== Retrieved Information ======\n")
- cat("-----------------------------------\n")
- cat(" URL: \n", set_api_url, "\n")
- cat(" Date Range: ", as.character(transformed_date_meeting(start_date)),
- " to ", as.character(transformed_date_meeting(end_date)), "\n")
- cat(" Total Meetings: ", nrow(df), "\n")
- cat("===================================\n")
- }
-
- list_data <- list("title" = "the meeting records of cross-caucus session",
- "query_time" = Sys.time(),
- "retrieved_number" = nrow(df),
- "start_date_ad" = transformed_date_meeting(start_date),
- "end_date_ad" = transformed_date_meeting(end_date),
- "start_date" = start_date,
- "end_date" = end_date,
- "url" = set_api_url,
- "variable_names" = colnames(df),
- "manual_info" = "https://data.ly.gov.tw/getds.action?id=8",
- "data" = df)
- return(list_data)
- },
- error = function(error_message) {
- if(isTRUE(verbose)) {
- close(pb)
- cat("\n")
- }
- message(error_message)
- }
- )
-}
-
-#' @title The Video Information of Meetings and Committees 院會及委員會之委員發言片段相關影片資訊
-#'
-#' @param term numeric or NULL. Legislative term number (e.g., 10). Data is available from the 9th term onwards.
-#' @param session_period numeric or NULL. Session period (1-8).
-#' @param start_date character Must be formatted in Minguo (ROC) calendar with three
-#' forward slashes between year, month and day, e.g. "110/10/01".
-#' @param end_date character Must be formatted in Minguo (ROC) calendar with three
-#' forward slashes between year, month and day, e.g. "110/10/30".
-#' @param verbose logical, indicates whether get_speech_video should print out
-#' detailed output when retrieving the data. Default is TRUE.
-#'
-#' @return list, which contains:
-#' \describe{
-#' \item{`title`}{speech video records}
-#' \item{`query_time`}{query timestamp}
-#' \item{`retrieved_number`}{number of videos retrieved}
-#' \item{`term`}{queried legislative term}
-#' \item{`session_period`}{queried session period}
-#' \item{`start_date_ad`}{start date in POSIXct}
-#' \item{`end_date_ad`}{end date in POSIXct}
-#' \item{`start_date`}{start date in ROC calendar}
-#' \item{`end_date`}{end date in ROC calendar}
-#' \item{`url`}{retrieved API URL}
-#' \item{`variable_names`}{variables in the tibble dataframe}
-#' \item{`manual_info`}{official manual URL}
-#' \item{`data`}{a tibble dataframe containing:
-#' \describe{
-#' \item{`term`}{屆別}
-#' \item{`sessionPeriod`}{會期}
-#' \item{`meetingDate`}{會議日期(西元年)}
-#' \item{`meetingTime`}{會議時間}
-#' \item{`meetingTypeName`}{主辦單位}
-#' \item{`meetingName`}{會議名稱}
-#' \item{`meetingContent`}{會議事由}
-#' \item{`legislatorName`}{委員姓名}
-#' \item{`areaName`}{選區名稱}
-#' \item{`speechStartTime`}{委員發言時間起}
-#' \item{`speechEndTime`}{委員發言時間迄}
-#' \item{`speechRecordUrl`}{發言紀錄網址}
-#' \item{`videoLength`}{影片長度}
-#' \item{`videoUrl`}{影片網址}
-#' \item{`selectTerm`}{屆別期別篩選條件}
-#' }
-#' }
-#' }
-#'
-#' @importFrom attempt stop_if_all
-#' @importFrom jsonlite fromJSON
-#' @importFrom withr with_options
-#'
-#' @export
-#'
-#' @examples
-#' ## Query video information by term, session period and date range
-#' get_speech_video(
-#' term = 10,
-#' session_period = 4,
-#' start_date = "110/10/01",
-#' end_date = "110/10/30"
-#' )
-#'
-#' ## Query without specifying term or session
-#' get_speech_video(
-#' start_date = "110/10/01",
-#' end_date = "110/10/30"
-#' )
-#'
-#' @details The `get_speech_video` function retrieves video information of
-#' legislative meetings and committee sessions. Data is available from the
-#' 9th legislative term onwards (2016/民國105年). The date parameters must
-#' use the ROC calendar format with forward slashes.
-#'
-#' @note For more details about the data variables and API information,
-#' use `get_variable_info("get_speech_video")` or visit the API manual at
-#' \url{https://data.ly.gov.tw/getds.action?id=148}.
-#' 會議類:提供立法院院會及委員會之委員發言片段相關影片資訊 (自第9屆第1會期起)。
-#'
-#' @seealso
-#' `get_variable_info("get_speech_video")`
-
-# https://data.ly.gov.tw/odw/ID148Action.action?term=10&sessionPeriod=4&meetingDateS=110/10/01&meetingDateE=110/10/30&meetingTime=&legislatorName=&fileType=csv
-get_speech_video <- function(term = NULL,
- session_period = NULL,
- start_date = NULL,
- end_date = NULL,
- verbose = TRUE,
- format = "json") {
- # Check internet connectivity
- check_internet()
-
- # Format validation
- format <- match.arg(format, c("json", "csv"))
-
- if(isTRUE(verbose)) {
- cat("\nInput Format Information:\n")
- cat("------------------------\n")
- cat("Term: Must be numeric (e.g., 8, 9, 10)\n")
- cat("Session Period: Must be numeric (1-8)\n")
- cat("Date Format: YYY/MM/DD (ROC calendar)\n")
- cat("Example: 110/10/01\n")
- cat("------------------------\n\n")
- cat("Downloading speech video data...\n")
- pb <- txtProgressBar(min = 0, max = 100, style = 3)
- }
-
- # Date validation
- if(is.null(start_date) || is.null(end_date)) {
- stop("Both start_date and end_date must be provided")
- }
-
- # Input data validation
- if(!is.null(term)) {
- term_str <- sprintf("%02d", as.numeric(term))
- } else {
- term_str <- ""
- }
-
- if(!is.null(session_period)) {
- session_str <- sprintf("%02d", as.numeric(session_period))
- } else {
- session_str <- ""
- }
-
- # Update progress bar to 20%
- if(isTRUE(verbose)) setTxtProgressBar(pb, 20)
-
- # Construct API URL
- set_api_url <- paste0("https://data.ly.gov.tw/odw/ID148Action.action?",
- "term=", term_str,
- "&sessionPeriod=", session_str,
- "&meetingDateS=", start_date,
- "&meetingDateE=", end_date,
- "&meetingTime=&legislatorName=&fileType=", format)
-
- # Update progress bar to 40%
- if(isTRUE(verbose)) setTxtProgressBar(pb, 40)
-
- tryCatch(
- {
- # Update progress bar to 60%
- if(isTRUE(verbose)) setTxtProgressBar(pb, 60)
-
- if(format == "json") {
- response <- try({
- json_df <- jsonlite::fromJSON(set_api_url)
- if(!is.null(json_df$dataList)) {
- df <- tibble::as_tibble(json_df$dataList)
- } else {
- df <- tibble::tibble()
- }
- }, silent = TRUE)
- } else {
- response <- try({
- df <- readr::read_csv(set_api_url, show_col_types = FALSE)
- }, silent = TRUE)
- }
-
- # Update progress bar to 80%
- if(isTRUE(verbose)) setTxtProgressBar(pb, 80)
-
- # Data validation
- if(nrow(df) == 0) {
- if(isTRUE(verbose)) {
- setTxtProgressBar(pb, 100)
- close(pb)
- cat("\n\n")
- cat("====== Query Result ======\n")
- cat("-------------------------\n")
- cat("No records found. Please check:\n")
- cat("1. Date format (YYY/MM/DD)\n")
- cat("2. Term and session period\n")
- cat("3. Data availability\n")
- cat("-------------------------\n")
- }
- return(NULL)
- }
-
- # Update progress bar to 100%
- if(isTRUE(verbose)) {
- setTxtProgressBar(pb, 100)
- close(pb)
- cat("\n\n")
- cat("====== Retrieved Information ======\n")
- cat("-----------------------------------\n")
- cat(" Retrieved URL: \n", set_api_url, "\n")
- cat(" Term: ", term_str, "\n")
- if(!is.null(session_period)) {
- cat(" Session Period: ", session_period, "\n")
- }
- cat(" Date Range: ", start_date, " to ", end_date, "\n")
- cat(" Total Videos: ", nrow(df), "\n")
- cat(" Format: ", toupper(format), "\n")
- cat("===================================\n")
- }
-
- # Return data
- list_data <- list(
- "title" = "speech video records",
- "query_time" = Sys.time(),
- "retrieved_number" = nrow(df),
- "term" = term_str,
- "session_period" = session_str,
- "start_date" = start_date,
- "end_date" = end_date,
- "format" = format,
- "url" = set_api_url,
- "variable_names" = colnames(df),
- "manual_info" = "https://data.ly.gov.tw/getds.action?id=148",
- "data" = df
- )
- return(list_data)
- },
- error = function(error_message) {
- if(isTRUE(verbose)) {
- close(pb)
- cat("\nError occurred:\n")
- cat(as.character(error_message), "\n")
- }
- return(NULL)
- }
- )
-}
-
-
-#' The Records of National Public Debates 國是論壇
-#'
-#' @param term numeric or NULL. The default is set to 10. Legislative term number
-#' (e.g., 10). Data is officially available from the 8th term onwards, but
-#' testing shows data starts from the 10th term.
-#'
-#' @param session_period numeric or NULL. Session period number (1-8). Default is NULL.
-#' Use `review_session_info()` to see available session periods in ROC calendar.
-#'
-#' @param verbose logical. Whether to display download progress and detailed information.
-#' Default is TRUE.
-#'
-#' @return A list containing:
-#' \describe{
-#' \item{`title`}{public debates records}
-#' \item{`query_time`}{query timestamp}
-#' \item{`retrieved_number`}{number of records retrieved}
-#' \item{`retrieved_term`}{queried legislative term}
-#' \item{`url`}{retrieved API URL}
-#' \item{`variable_names`}{variables in the tibble dataframe}
-#' \item{`manual_info`}{official manual URL or use get_variable_info("get_public_debates")}
-#' \item{`data`}{a tibble dataframe containing:
-#' \describe{
-#' \item{`term`}{屆別}
-#' \item{`sessionPeriod`}{會期}
-#' \item{`sessionTimes`}{會次}
-#' \item{`meetingTimes`}{臨時會會次}
-#' \item{`dateTimeDesc`}{日期時間說明}
-#' \item{`meetingRoom`}{會議地點}
-#' \item{`chairman`}{主持人}
-#' \item{`legislatorName`}{委員姓名}
-#' \item{`speakType`}{發言類型(paper:書面發言,speak:發言)}
-#' \item{`content`}{內容}
-#' \item{`selectTerm`}{屆別期別篩選條件}
-#' }
-#' }
-#' }
-#'
-#' @importFrom attempt stop_if_all
-#' @importFrom jsonlite fromJSON
-#' @importFrom withr with_options
-#'
-#' @export
-#'
-#' @examples
-#' # Query public debates for term 10, session period 2
-#' debates <- get_public_debates(term = 10, session_period = 2)
-#'
-#' # Query without specifying session period
-#' debates <- get_public_debates(term = 10)
-#'
-#' @details
-#' The function retrieves records from the National Public Debates (國是論壇),
-#' including both spoken and written opinions. While officially available from
-#' the 8th legislative term, testing indicates data is only available from
-#' the 10th term onwards.
-#'
-#' @note
-#' For more details about the data variables and API information,
-#' use `get_variable_info("get_public_debates")` or visit the API manual at
-#' \url{https://data.ly.gov.tw/getds.action?id=7}.
-#' 議事類: 提供公報之國是論壇資訊,並包含書面意見。
-#' 自第8屆第1會期起,但實測資料從第10屆。
-#'
-#' @seealso
-#' * `get_variable_info("get_public_debates")`
-#' * `review_session_info()`
-#' * For ROC calendar information: \url{https://en.wikipedia.org/wiki/Republic_of_China_calendar}
-get_public_debates <- function(term = NULL, session_period = NULL, verbose = TRUE) {
- check_internet()
-
- if(isTRUE(verbose)) {
- cat("\nInput Format Information:\n")
- cat("------------------------\n")
- cat("Term: Must be numeric (e.g., 8, 9, 10)\n")
- cat("Session Period: Must be numeric (1-8)\n")
- cat("------------------------\n\n")
- cat("Downloading public debates data...\n")
- pb <- txtProgressBar(min = 0, max = 100, style = 3)
- }
-
- # Update progress bar to 20%
- if(isTRUE(verbose)) setTxtProgressBar(pb, 20)
-
- if (is.null(term)) {
- set_api_url <- paste("https://data.ly.gov.tw/odw/ID7Action.action?term=",
- term, "&sessionPeriod=",
- "&sessionTimes=&meetingTimes=&legislatorName=&speakType=&fileType=json",
- sep = "")
- message(" term is not defined...\n You are now requesting full data from the API. Please make sure your connectivity is stable until its completion.\n")
- } else {
- attempt::stop_if_all(term, is.character, msg = "\nPlease use numeric format only.")
- if (length(term) == 1) {
- term <- sprintf("%02d", as.numeric(term))
- } else if (length(term) > 1) {
- if(isTRUE(verbose)) close(pb)
- term <- paste(sprintf("%02d", as.numeric(term)), collapse = "&")
- message("The API is unable to query multiple terms and the retrieved data might not be complete.")
- }
- }
-
- # Update progress bar to 40%
- if(isTRUE(verbose)) setTxtProgressBar(pb, 40)
-
- set_api_url <- paste("https://data.ly.gov.tw/odw/ID7Action.action?term=",
- term, "&sessionPeriod=",
- sprintf("%02d", as.numeric(session_period)),
- "&sessionTimes=&meetingTimes=&legislatorName=&speakType=&fileType=json",
- sep = "")
-
- tryCatch(
- {
- # Update progress bar to 60%
- if(isTRUE(verbose)) setTxtProgressBar(pb, 60)
-
- with_options(list(timeout = max(1000, getOption("timeout"))),{
- json_df <- jsonlite::fromJSON(set_api_url)
- })
-
- # Update progress bar to 80%
- if(isTRUE(verbose)) setTxtProgressBar(pb, 80)
-
- df <- tibble::as_tibble(json_df$dataList)
- attempt::stop_if_all(nrow(df) == 0, isTRUE, msg = "The query is unavailable.")
-
- # Update progress bar to 100%
- if(isTRUE(verbose)) {
- setTxtProgressBar(pb, 100)
- close(pb)
- cat("\n\n") # Add newlines after progress bar
- cat("====== Retrieved Information ======\n")
- cat("-----------------------------------\n")
- cat(" Retrieved URL: \n", set_api_url, "\n")
- cat(" Term: ", term, "\n")
- if(!is.null(session_period)) {
- cat(" Session Period: ", session_period, "\n")
- }
- cat(" Total Records: ", nrow(df), "\n")
- if("legislatorName" %in% colnames(df)) {
- unique_legislators <- length(unique(df$legislatorName))
- cat(" Unique Legislators: ", unique_legislators, "\n")
- }
- cat("===================================\n")
- }
-
- list_data <- list(
- "title" = "public debates records",
- "query_time" = Sys.time(),
- "retrieved_number" = nrow(df),
- "retrieved_term" = term,
- "url" = set_api_url,
- "variable_names" = colnames(df),
- "manual_info" = "https://data.ly.gov.tw/getds.action?id=7",
- "data" = df
- )
- return(list_data)
- },
- error = function(error_message) {
- if(isTRUE(verbose)) {
- close(pb)
- cat("\n")
- }
- message(error_message)
- }
- )
-}
-
-#' The Records of Reviewed Items in the Committees 委員會會議審查之議案項目
-#'
-#'@author David Yen-Chieh Liao
-#'
-#'@param term numeric or null. Data is available only from the 8th term.
-#'The default is set to 10. 參數必須為數值。提供委員會會議審查之議案項目。(自第10屆第1會期起)
-#'
-#'@param session_period integer, numeric or NULL.
-#'`review_session_info()` provides each session period's available options based on the
-#' Minguo (Taiwan) calendar.
-#'
-#'@param verbose logical. This indicates whether `get_executive_response` should
-#'print a detailed output during data retrieval. Default is TRUE.
-#'
-#'@return A list containing:
-#' \item{`title`}{Records of questions answered by executives}
-#' \item{`query_time`}{Time of query}
-#' \item{`retrieved_number`}{Total number of observations}
-#' \item{`retrieved_term`}{Queried term}
-#' \item{`url`}{Retrieved JSON URL}
-#' \item{`variable_names`}{Variables of the tibble dataframe}
-#' \item{`manual_info`}{Official manual, \url{https://data.ly.gov.tw/getds.action?id=46}; or use get_variable_info("get_committee_record")}
-#' \item{`data`}{A tibble dataframe with variables:
-#' \describe{
-#' \item{`term`}{Term number}
-#' \item{`sessionPeriod`}{Session}
-#' \item{`meetingNo`}{Meeting number}
-#' \item{`billNo`}{Bill number}
-#' \item{`selectTerm`}{Term selection filter}
-#' }
-#' }
-#'
-#'@importFrom attempt stop_if_all
-#'@importFrom jsonlite fromJSON
-#'@importFrom withr with_options
-#'
-#'@export
-#'
-#'@examples
-#' ## Query the committee record by term and session period.
-#' ## 輸入「立委屆期」與「會期」下載「委員會審議之議案」
-#'get_committee_record(term = 10, session_period = 1)
-#'
-#'@details `get_committee_record` provides a list which includes `title`,
-#'`query_time`, `retrieved_number`, `retrieved_term`, `url`, `variable_names`,
-#' `manual_info`, and `data`.
-#'
-#'@note
-#' To access the user manual and more information about the data frame's variables,
-#' please refer to `get_variable_info("get_committee_record")` or check the API manual at
-#' \url{https://data.ly.gov.tw/getds.action?id=46}.
-#' This provides agenda items reviewed in committee meetings (from the 10th term, 1st session onwards).
-#'
-#'@seealso
-#'`get_variable_info("get_committee_record")`, `review_session_info()`
-#' The Records of Reviewed Items in the Committees 委員會會議審查之議案項目
-#'
-#'@author David Yen-Chieh Liao
-#'
-#'@param term numeric or null. Data is available only from the 8th term.
-#'The default is set to 10. 參數必須為數值。提供委員會會議審查之議案項目。(自第10屆第1會期起)
-#'
-#'@param session_period integer, numeric or NULL.
-#'`review_session_info()` provides each session period's available options based on the
-#' Minguo (Taiwan) calendar.
-#'
-#'@param verbose logical. This indicates whether `get_executive_response` should
-#'print a detailed output during data retrieval. Default is TRUE.
-#'
-#'@return A list containing:
-#' \item{`title`}{Records of questions answered by executives}
-#' \item{`query_time`}{Time of query}
-#' \item{`retrieved_number`}{Total number of observations}
-#' \item{`retrieved_term`}{Queried term}
-#' \item{`url`}{Retrieved JSON URL}
-#' \item{`variable_names`}{Variables of the tibble dataframe}
-#' \item{`manual_info`}{Official manual, \url{https://data.ly.gov.tw/getds.action?id=46}; or use get_variable_info("get_committee_record")}
-#' \item{`data`}{A tibble dataframe with variables:
-#' \describe{
-#' \item{`term`}{Term number}
-#' \item{`sessionPeriod`}{Session}
-#' \item{`meetingNo`}{Meeting number}
-#' \item{`billNo`}{Bill number}
-#' \item{`selectTerm`}{Term selection filter}
-#' }
-#' }
-#'
-#'@importFrom attempt stop_if_all
-#'@importFrom jsonlite fromJSON
-#'@importFrom withr with_options
-#'
-#'@export
-#'
-#'@examples
-#' ## Query the committee record by term and session period.
-#' ## 輸入「立委屆期」與「會期」下載「委員會審議之議案」
-#'get_committee_record(term = 10, session_period = 1)
-#'
-#'@details `get_committee_record` provides a list which includes `title`,
-#'`query_time`, `retrieved_number`, `retrieved_term`, `url`, `variable_names`,
-#' `manual_info`, and `data`.
-#'
-#'@note
-#' To access the user manual and more information about the data frame's variables,
-#' please refer to `get_variable_info("get_committee_record")` or check the API manual at
-#' \url{https://data.ly.gov.tw/getds.action?id=46}.
-#' This provides agenda items reviewed in committee meetings (from the 10th term, 1st session onwards).
-#'
-#'@seealso
-#'`get_variable_info("get_committee_record")`, `review_session_info()`
-get_committee_record <- function(term = 10, session_period = NULL, verbose = TRUE) {
- check_internet()
-
- if(isTRUE(verbose)) {
- cat("\nInput Format Information:\n")
- cat("------------------------\n")
- cat("Term: Must be numeric (e.g., 8, 9, 10)\n")
- cat("Session Period: Must be numeric (1-8)\n")
- cat("------------------------\n\n")
- cat("Downloading committee records data...\n")
- pb <- txtProgressBar(min = 0, max = 100, style = 3)
- }
-
- # Update progress bar to 20%
- if(isTRUE(verbose)) setTxtProgressBar(pb, 20)
-
- if (is.null(term)) {
- set_api_url <- paste("https://data.ly.gov.tw/odw/ID46Action.action?term=",
- term, "&sessionPeriod=",
- "&sessionTimes=01&meetingTimes=&fileType=json", sep = "")
- message(" term is not defined...\n You are now requesting full data from the API. Please make sure your connectivity is stable until its completion.\n")
- } else {
- attempt::stop_if_all(term, is.character, msg = "use numeric format only.")
- if (length(term) == 1) {
- term <- sprintf("%02d", as.numeric(term))
- } else if (length(term) > 1) {
- if(isTRUE(verbose)) close(pb)
- term <- paste(sprintf("%02d", as.numeric(term)), collapse = "&")
- message("The API is unable to query multiple terms and the retrieved data might not be complete.")
- }
- }
-
- # Update progress bar to 40%
- if(isTRUE(verbose)) setTxtProgressBar(pb, 40)
-
- set_api_url <- paste("https://data.ly.gov.tw/odw/ID46Action.action?term=",
- term,
- "&sessionPeriod=", sprintf("%02d", as.numeric(session_period)),
- "&sessionTimes=01&meetingTimes=&fileType=json", sep = "")
-
- tryCatch(
- {
- # Update progress bar to 60%
- if(isTRUE(verbose)) setTxtProgressBar(pb, 60)
-
- with_options(list(timeout = max(1000, getOption("timeout"))),{
- json_df <- jsonlite::fromJSON(set_api_url)
- })
-
- # Update progress bar to 80%
- if(isTRUE(verbose)) setTxtProgressBar(pb, 80)
-
- df <- tibble::as_tibble(json_df$dataList)
- attempt::stop_if_all(nrow(df) == 0, isTRUE, msg = "The query is unavailable.")
-
- # Update progress bar to 100%
- if(isTRUE(verbose)) {
- setTxtProgressBar(pb, 100)
- close(pb)
- cat("\n\n") # Add newlines after progress bar
- cat("====== Retrieved Information ======\n")
- cat("-----------------------------------\n")
- cat(" Retrieved URL: \n", set_api_url, "\n")
- cat(" Term: ", term, "\n")
- if(!is.null(session_period)) {
- cat(" Session Period: ", session_period, "\n")
- }
- cat(" Total Records: ", nrow(df), "\n")
-
- if("committee" %in% colnames(df)) {
- committee_counts <- table(df$committee)
- cat("\nCommittee Distribution:\n")
- for(comm in names(committee_counts)) {
- cat(sprintf(" %s: %d\n", comm, committee_counts[comm]))
- }
- }
- cat("===================================\n")
- }
-
- list_data <- list(
- "title" = "the records of reviewed items in the committees",
- "query_time" = Sys.time(),
- "retrieved_number" = nrow(df),
- "retrieved_term" = term,
- "url" = set_api_url,
- "variable_names" = colnames(df),
- "manual_info" = "https://data.ly.gov.tw/getds.action?id=46",
- "data" = df
- )
- return(list_data)
- },
- error = function(error_message) {
- if(isTRUE(verbose)) {
- close(pb)
- cat("\n")
- }
- message(error_message)
- }
- )
-}
diff --git a/.Rproj.user/763C8F27/sources/session-ab45fd2f/08B39A84-contents b/.Rproj.user/763C8F27/sources/session-ab45fd2f/08B39A84-contents
deleted file mode 100644
index ea74c439..00000000
--- a/.Rproj.user/763C8F27/sources/session-ab45fd2f/08B39A84-contents
+++ /dev/null
@@ -1,77 +0,0 @@
-% Generated by roxygen2: do not edit by hand
-% Please edit documentation in R/meeting.R
-\name{get_caucus_meetings}
-\alias{get_caucus_meetings}
-\title{The Meeting Records of Cross-caucus Session 黨團協商資訊}
-\usage{
-get_caucus_meetings(start_date = NULL, end_date = NULL, verbose = TRUE)
-}
-\arguments{
-\item{start_date}{character Must be formatted in Minguo (ROC) calendar with three
-forward slashes between year, month and day, e.g. "106/10/20".}
-
-\item{end_date}{character Must be formatted in Minguo (ROC) calendar with three
-forward slashes between year, month and day, e.g. "109/01/10".}
-
-\item{verbose}{logical, indicates whether \code{get_caucus_meetings} should print out
-detailed output when retrieving the data.}
-}
-\value{
-list, which contains: \describe{
-\item{\code{title}}{the meeting records of cross-caucus session}
-\item{\code{query_time}}{the query time}
-\item{\code{retrieved_number}}{the number of observation}
-\item{\code{meeting_unit}}{the meeting unit}
-\item{\code{start_date_ad}}{the start date in POSIXct}
-\item{\code{end_date_ad}}{the end date in POSIXct}
-\item{\code{start_date}}{the start date in ROC Taiwan calendar}
-\item{\code{url}}{the retrieved json url}
-\item{\code{variable_names}}{the variables of the tibble dataframe}
-\item{\code{manual_info}}{the official manual, \url{https://data.ly.gov.tw/getds.action?id=8}; or use get_variable_info("get_caucus_meetings")}
-\item{\code{data}}{a tibble dataframe, whose variables include:
-\describe{\item{\code{comYear}}{卷}
-\item{\code{comVolume}}{期}
-\item{\code{comBookId}}{冊別}
-\item{\code{term}}{屆別}
-\item{\code{sessionPeriod}}{會期}
-\item{\code{meetingTimes}}{臨時會會次}
-\item{\code{meetingDate}}{會議日期(民國年)}
-\item{\code{meetingName}}{會議名稱}
-\item{\code{subject}}{案由}
-\item{\code{pageStart}}{起始頁}
-\item{\code{pageEnd}}{結束頁}
-\item{\code{docUrl}}{檔案下載位置}
-\item{\code{htmlUrl}}{html網址}
-\item{\code{selectTerm}}{屆別期別篩選條件}
-}
-}
-}
-}
-\description{
-The Meeting Records of Cross-caucus Session 黨團協商資訊
-}
-\details{
-\code{get_caucus_meetings} produces a list, which contains \code{title}, \code{query_time},
-\code{retrieved_number}, \code{meeting_unit}, \code{start_date_ad}, \code{end_date_ad}, \code{start_date},
-\code{end_date}, \code{url}, \code{variable_names}, \code{manual_info} and \code{data.}
-}
-\note{
-To retrieve the user manual and more information about variable of the data
-frame, please use \code{get_variable_info("get_caucus_meetings")}
-or visit the API manual at \url{https://data.ly.gov.tw/getds.action?id=8}.
-議事類:提供公報之黨團協商資訊 (自第8屆第1會期起)
-}
-\examples{
-## query the meeting records of cross-caucus session using a period of
-## the dates in Taiwan ROC calender format with forward slash (/).
-## 輸入「中華民國民年」下載「黨團協商」,輸入時間請依照該格式 "106/10/20",
-## 需有「正斜線」做隔開。
-get_caucus_meetings(start_date = "106/10/20", end_date = "107/03/10")
-
-}
-\seealso{
-\code{get_variable_info("get_caucus_meetings")} Regarding Minguo calendar, please see \url{https://en.wikipedia.org/wiki/Republic_of_China_calendar}.
-}
-\author{
-David Liao (davidycliao@gmail.com)
-}
diff --git a/.Rproj.user/763C8F27/sources/session-ab45fd2f/0A351AC8-contents b/.Rproj.user/763C8F27/sources/session-ab45fd2f/0A351AC8-contents
deleted file mode 100644
index 6cdadc46..00000000
--- a/.Rproj.user/763C8F27/sources/session-ab45fd2f/0A351AC8-contents
+++ /dev/null
@@ -1,23 +0,0 @@
-test_that("get_bills", {
- expect_equal(get_bills(start_date = 1060120, end_date = 1070310, proposer = "孔文吉", verbose = FALSE)$retrieved_number, 9)
-})
-
-test_that("get_bills_2", {
- expect_equal(get_bills_2(term = 8, session_period = 1, verbose = FALSE)$retrieved_number, 1155)
- expect_error(get_bills_2(term = "10"), "Please use numeric format only.")
- expect_error(get_bills_2(term = "10", verbose = TRUE), "Please use numeric format only.")
-})
-
-test_that("Testing get_bills function", {
-
- # Test if the function returns a list
- result <- get_bills(start_date = 1060120, end_date = 1070310, verbose = FALSE)
- expect_type(result, "list")
- # Test if get_bills throws the expected error for incorrect date format
- expect_error(get_bills(start_date = 1070310, end_date = 1060120, verbose = FALSE),
- "The start date, 2018-03-10, should not be later than the end date, 2017-01-20.")
-
- # Test if the function correctly handles invalid date format
- expect_error(get_bills(start_date = "10601", end_date = 1070310, verbose = FALSE),
- "Dates should be in numeric format. E.g., 1090101.")
-})
diff --git a/.Rproj.user/763C8F27/sources/session-ab45fd2f/0C74EFA9-contents b/.Rproj.user/763C8F27/sources/session-ab45fd2f/0C74EFA9-contents
deleted file mode 100644
index c4299b6f..00000000
--- a/.Rproj.user/763C8F27/sources/session-ab45fd2f/0C74EFA9-contents
+++ /dev/null
@@ -1,340 +0,0 @@
-#' The Records of Parliamentary Questions 委員質詢事項資訊
-#'
-#' @author David Liao (davidycliao@@gmail.com)
-#'
-#' @param term numeric or NULL. The default is set to NULL. 參數必須為數值。
-#'
-#' @param session_period integer, numeric or NULL. Available
-#' options for the session is: 1, 2, 3, 4, 5, 6, 7, and 8. The default is set to 8 參數必須為數值。
-#' `review_session_info()` generates each session period available option period
-#' in Minguo (Taiwan) calendar.
-#'
-#' @param verbose logical, indicates whether `get_parlquestions` should print out
-#' detailed output when retrieving the data. The default is TRUE.
-#'
-#' @return A list containing:
-#' \describe{
-#' \item{`title`}{the records of parliamentary questions}
-#' \item{`query_time`}{the queried time}
-#' \item{`retrieved_number`}{the total number of observations}
-#' \item{`retrieved_term`}{the queried term}
-#' \item{`url`}{the retrieved json url}
-#' \item{`variable_names`}{the variables of the tibble dataframe}
-#' \item{`manual_info`}{the offical manual from \url{https://data.ly.gov.tw/getds.action?id=6}, or use get_variable_info("get_parlquestions")}
-#' \item{`data`}{a tibble dataframe, whose variables include:
-#' \describe{
-#' \item{`term`}{屆別}
-#' \item{`sessionPeriod`}{會期}
-#' \item{`sessionTimes`}{會次}
-#' \item{`item`}{項目}
-#' \item{`selectTerm`}{屆別期別篩選條件}
-#' }
-#' }
-#' }
-#'
-#' @importFrom attempt stop_if_all
-#' @importFrom jsonlite fromJSON
-#' @importFrom withr with_options
-#' @export
-#'
-#' @examples
-#' ## Query parliamentary questions by term.
-#' ## 輸入「立委會期」下載立委質詢資料
-#' get_parlquestions(term = 10)
-#'
-#' ## Query parliamentary questions by term and session period.
-#' ## 輸入「立委屆期」與「會期」下載立委質詢資料
-#' get_parlquestions(term = 10, session_period = 2)
-#'
-#' @details `get_parlquestions` produces a list, which contains `title`,
-#' `query_time`, `retrieved_number`, `retrieved_term`, `url`, `variable_names`,
-#' `manual_info`, and `data`.
-#'
-#' @note To retrieve the user manual and more information about variable of the data
-#' frame, please use `get_variable_info("get_parlquestions")`
-#' or visit the API manual at \url{https://data.ly.gov.tw/getds.action?id=6}.
-#' 質詢類: 提供議事日程本院委員之質詢事項資訊(自第8屆第1會期起)。
-#'
-#' @seealso `get_variable_info("get_parlquestions")`
-get_parlquestions <- function(term = NULL, session_period = NULL, verbose = TRUE) {
- check_internet()
-
- # 先檢查 term 並顯示訊息
- if (is.null(term)) {
- message("\nTerm is not defined...\nRequesting full data from the API. Please ensure stable connectivity.\n")
- }
-
- # 初始化進度顯示
- if(isTRUE(verbose)) {
- cat("\nInput Format Information:\n")
- cat("------------------------\n")
- cat("Term: Must be numeric (e.g., 8, 9, 10)\n")
- cat("Session Period: Must be numeric (1-8)\n")
- cat("------------------------\n\n")
- cat("Downloading parliamentary questions data...\n")
- pb <- txtProgressBar(min = 0, max = 100, style = 3)
- }
-
- # Update progress bar to 20%
- if(isTRUE(verbose)) setTxtProgressBar(pb, 20)
-
- # 建構 API URL
- if (is.null(term)) {
- set_api_url <- paste("https://data.ly.gov.tw/odw/ID6Action.action?term=", term,
- "&sessionPeriod=",
- "&sessionTimes=&item=&fileType=json", sep = "")
- } else {
- attempt::stop_if_all(term, is.character, msg = "Please use numeric format only.")
- if (length(term) == 1) {
- term <- sprintf("%02d", as.numeric(term))
- } else if (length(term) > 1) {
- if(isTRUE(verbose)) close(pb)
- term <- paste(sprintf("%02d", as.numeric(term)), collapse = "&")
- stop("API does not support multiple terms.")
- }
- }
-
- # Update progress bar to 40%
- if(isTRUE(verbose)) setTxtProgressBar(pb, 40)
-
- set_api_url <- paste("https://data.ly.gov.tw/odw/ID6Action.action?term=", term,
- "&sessionPeriod=",
- sprintf("%02d", as.numeric(session_period)),
- "&sessionTimes=&item=&fileType=json", sep = "")
-
- tryCatch(
- {
- # Update progress bar to 60%
- if(isTRUE(verbose)) setTxtProgressBar(pb, 60)
-
- with_options(list(timeout = max(1000, getOption("timeout"))),{
- json_df <- jsonlite::fromJSON(set_api_url)
- })
-
- # Update progress bar to 80%
- if(isTRUE(verbose)) setTxtProgressBar(pb, 80)
-
- df <- tibble::as_tibble(json_df$dataList)
- attempt::stop_if_all(nrow(df) == 0, isTRUE, msg = "Query returned no data.")
-
- # Update progress bar to 100% and show results
- if(isTRUE(verbose)) {
- setTxtProgressBar(pb, 100)
- close(pb)
- cat("\n\n")
- cat("====== Retrieved Information ======\n")
- cat("-----------------------------------\n")
- cat(" URL: \n", set_api_url, "\n")
- cat(" Term: ", term, "\n")
- if(!is.null(session_period)) {
- cat(" Session Period: ", session_period, "\n")
- }
- cat(" Total Questions: ", nrow(df), "\n")
-
- # Add session period distribution if available
- if("sessionPeriod" %in% colnames(df)) {
- session_counts <- table(df$sessionPeriod)
- cat("\nSession Distribution:\n")
- for(session in names(session_counts)) {
- cat(sprintf(" Session %s: %d\n", session, session_counts[session]))
- }
- }
- cat("===================================\n")
- }
-
- # 回傳結果
- list_data <- list(
- "title" = "Parliamentary Questions Records",
- "query_time" = Sys.time(),
- "retrieved_number" = nrow(df),
- "retrieved_term" = term,
- "url" = set_api_url,
- "variable_names" = colnames(df),
- "manual_info" = "https://data.ly.gov.tw/getds.action?id=6",
- "data" = df
- )
- return(list_data)
- },
- error = function(error_message) {
- if(isTRUE(verbose)) {
- close(pb)
- cat("\nError occurred while fetching data:\n")
- cat(sprintf("Error: %s\n", error_message))
- }
- message(error_message)
- }
- )
-}
-
-#'The Records of Response to the Questions by the Executives 公報質詢事項行政院答復資訊
-#'
-#'@author David Liao (davidycliao@@gmail.com)
-#'
-#'@param term integer, numeric or NULL. The default is NULL. The data is only
-#'available from 8th term. 參數必須為數值。資料從自第8屆起,預設值為8。
-#'
-#'@param session_period integer, numeric or NULL. Available
-#'options for the session is: 1, 2, 3, 4, 5, 6, 7, and 8. The default is set to NULL. 參數必須為數值。
-#'`review_session_info()` generates each session period available option period
-#' in Minguo (Taiwan) calendar.
-#'
-#'@param verbose logical, indicates whether `get_executive_response` should
-#'print out detailed output when retrieving the data. The default is set to TRUE
-#'
-#'@return list contains: \describe{
-#' \item{`title`}{the records of the questions answered by the executives}
-#' \item{`query_time`}{the queried time}
-#' \item{`retrieved_number`}{the total number of observations}
-#' \item{`retrieved_term`}{the queried term}
-#' \item{`url`}{the retrieved json url}
-#' \item{`variable_names`}{the variables of the tibble dataframe}
-#' \item{`manual_info`}{the offical manual}
-#' \item{`data`}{a tibble dataframe, whose variables include:
-#' \describe{\item{`term`}{屆別}
-#' \item{`sessionPeriod`}{會期}
-#' \item{`sessionTimes`}{會次}
-#' \item{`meetingTimes`}{臨時會會次}
-#' \item{`eyNumber`}{行政院函公文編號}
-#' \item{`lyNumber`}{立法院函編號}
-#' \item{`subject`}{案由}
-#' \item{`content`}{內容}
-#' \item{`docUrl`}{案由}
-#' \item{`item`}{檔案下載位置}
-#' \item{`item`}{檔案下載位置}
-#' \item{`selectTerm`}{屆別期別篩選條件}
-#' }
-#' }
-#' }
-#'
-#'@importFrom attempt stop_if_all
-#'@importFrom jsonlite fromJSON
-#'@importFrom withr with_options
-#'@export
-#'
-#'@examples
-#' ## query the Executives' answered response by term and the session period.
-#' ## 輸入「立委屆期」與「會期」下載「行政院答復」
-#' get_executive_response(term = 8, session_period = 1)
-#'
-#'@details **`get_executive_response`** produces a list, which contains `title`,
-#'`query_time`, `retrieved_number`, `retrieved_term`, `url`, `variable_names`,
-#' `manual_info` and `data`. To retrieve the user manual and more information, please
-#' use `get_variable_info("get_executive_response")`.
-#'
-#'
-#'#'@note To retrieve the user manual and more information about variable of the data
-#' frame, please use `get_variable_info("get_executive_response")`
-#' or visit the API manual at \url{https://data.ly.gov.tw/getds.action?id=2}.
-#' 質詢類: 提供公報質詢事項行政院答復資訊 (自第8屆第1會期起)。
-#'
-#'@seealso
-#'`get_variable_info("get_executive_response")`, `review_session_info()`
-get_executive_response <- function(term = NULL, session_period = NULL, verbose = TRUE) {
- check_internet()
-
- # 先檢查 term 並顯示訊息
- if (is.null(term)) {
- message("\nTerm is not defined...\nRequesting full data from the API. Please ensure stable connectivity.\n")
- }
-
- # 初始化進度顯示
- if(isTRUE(verbose)) {
- cat("\nInput Format Information:\n")
- cat("------------------------\n")
- cat("Term: Must be numeric (e.g., 8, 9, 10, 11)\n")
- cat("Session Period: Must be numeric (1-8)\n")
- cat("------------------------\n\n")
- cat("Downloading executive response data...\n")
- pb <- txtProgressBar(min = 0, max = 100, style = 3)
- }
-
- # Update progress bar to 20%
- if(isTRUE(verbose)) setTxtProgressBar(pb, 20)
-
- # 建構 API URL
- if (is.null(term)) {
- set_api_url <- paste("https://data.ly.gov.tw/odw/ID2Action.action?term=",
- term, "&sessionPeriod=",
- "&sessionTimes=&item=&fileType=json", sep = "")
- } else {
- attempt::stop_if_all(term, is.character, msg = "Please use numeric format only.")
- if (length(term) == 1) {
- term <- sprintf("%02d", as.numeric(term))
- } else if (length(term) > 1) {
- if(isTRUE(verbose)) close(pb)
- term <- paste(sprintf("%02d", as.numeric(term)), collapse = "&")
- stop("API does not support multiple terms.")
- }
- }
-
- # Update progress bar to 40%
- if(isTRUE(verbose)) setTxtProgressBar(pb, 40)
-
- set_api_url <- paste("https://data.ly.gov.tw/odw/ID2Action.action?term=",
- term, "&sessionPeriod=",
- sprintf("%02d", as.numeric(session_period)),
- "&sessionTimes=&item=&fileType=json", sep = "")
-
- tryCatch(
- {
- # Update progress bar to 60%
- if(isTRUE(verbose)) setTxtProgressBar(pb, 60)
-
- with_options(list(timeout = max(1000, getOption("timeout"))),{
- json_df <- jsonlite::fromJSON(set_api_url)
- })
-
- # Update progress bar to 80%
- if(isTRUE(verbose)) setTxtProgressBar(pb, 80)
-
- df <- tibble::as_tibble(json_df$dataList)
- attempt::stop_if_all(nrow(df) == 0, isTRUE, msg = "Query returned no data.")
-
- # Update progress bar to 100% and show results
- if(isTRUE(verbose)) {
- setTxtProgressBar(pb, 100)
- close(pb)
- cat("\n\n")
- cat("====== Retrieved Information ======\n")
- cat("-----------------------------------\n")
- cat(" URL: \n", set_api_url, "\n")
- cat(" Term: ", term, "\n")
- if(!is.null(session_period)) {
- cat(" Session Period: ", session_period, "\n")
- }
- cat(" Total Responses: ", nrow(df), "\n")
-
- # Add session period distribution if available
- if("sessionPeriod" %in% colnames(df)) {
- session_counts <- table(df$sessionPeriod)
- cat("\nSession Distribution:\n")
- for(session in names(session_counts)) {
- cat(sprintf(" Session %s: %d\n", session, session_counts[session]))
- }
- }
- cat("===================================\n")
- }
-
- # 回傳結果
- list_data <- list(
- "title" = "Executive Response Records",
- "query_time" = Sys.time(),
- "retrieved_number" = nrow(df),
- "retrieved_term" = term,
- "url" = set_api_url,
- "variable_names" = colnames(df),
- "manual_info" = "https://data.ly.gov.tw/getds.action?id=2",
- "data" = df
- )
- return(list_data)
- },
- error = function(error_message) {
- if(isTRUE(verbose)) {
- close(pb)
- cat("\nError occurred while fetching data:\n")
- cat(sprintf("Error: %s\n", error_message))
- }
- message(error_message)
- }
- )
-}
diff --git a/.Rproj.user/763C8F27/sources/session-ab45fd2f/0E61B00D-contents b/.Rproj.user/763C8F27/sources/session-ab45fd2f/0E61B00D-contents
deleted file mode 100644
index 8fe48329..00000000
--- a/.Rproj.user/763C8F27/sources/session-ab45fd2f/0E61B00D-contents
+++ /dev/null
@@ -1,369 +0,0 @@
-#' @title The Records of the Bills: 法律提案
-#'
-#' @param start_date numeric. Must be formatted in the ROC Taiwan calendar, e.g., 1090101.
-#' @param end_date numeric. Must be formatted in the ROC Taiwan calendar, e.g., 1090102.
-#' @param proposer The default value is NULL, indicating that bills proposed by all legislators
-#' are included between the start and end dates.
-#' @param verbose logical. Specifies whether `get_bills` should print out
-#' detailed output when retrieving the data. The default value is TRUE.
-#'
-#' @return A list, which contains:
-#' \describe{
-#' \item{`title`}{Records of cross-caucus sessions}
-#' \item{`query_time`}{Query timestamp}
-#' \item{`retrieved_number`}{Number of observations retrieved}
-#' \item{`meeting_unit`}{Meeting unit}
-#' \item{`start_date_ad`}{Start date in POSIXct format}
-#' \item{`end_date_ad`}{End date in POSIXct format}
-#' \item{`start_date`}{Start date in the ROC Taiwan calendar}
-#' \item{`url`}{URL of the retrieved JSON data}
-#' \item{`variable_names`}{Variable names of the tibble dataframe}
-#' \item{`manual_info`}{Official manual. See \url{https://www.ly.gov.tw/Pages/List.aspx?nodeid=153} or use get_variable_info("get_bills")}
-#' \item{`data`}{A tibble dataframe with the following variables:
-#' \describe{\item{`term`}{Session number}
-#' \item{`sessionPeriod`}{Session period}
-#' \item{`sessionTimes`}{Session count}
-#' \item{`meetingTimes`}{Proposal date}
-#' \item{`billName`}{Bill name}
-#' \item{`billProposer`}{Primary proposer}
-#' \item{`billCosignatory`}{Co-signatories of the bill}
-#' \item{`billStatus`}{Status of the bill}
-#' \item{`date_ad`}{Date in the Gregorian calendar}
-#' }
-#' }
-#' }
-#'
-#' @importFrom httr GET
-#' @importFrom httr content
-#' @importFrom jsonlite fromJSON
-#' @importFrom tibble as_tibble
-#' @importFrom withr with_options
-#'
-#' @export
-#'
-#' @examples
-#' \dontrun{
-#' ## Query bill records by a date range in the Taiwan ROC calendar format
-#' get_bills(start_date = 1060120, end_date = 1070310, verbose = TRUE)
-#'
-#' ## Query bill records by a date range and a specific legislator
-#' get_bills(start_date = 1060120, end_date = 1070310, proposer = "孔文吉")
-#'
-#' ## Query bill records by a date range and multiple legislators
-#' get_bills(start_date = 1060120, end_date = 1060510, proposer = "孔文吉&鄭天財")
-#' }
-#'
-#' @details The `get_bills` function returns a list that contains `query_time`,
-#' `retrieved_number`, `meeting_unit`, `start_date_ad`, `end_date_ad`, `start_date`,
-#' `end_date`, `url`, `variable_names`, `manual_info`, and `data`.
-#'
-#' @note To retrieve the user manual and more details about the data frame, use `get_variable_info("get_bills")`.
-#' Further checks are required as the user manual seems to be inconsistent with the actual data.
-#'
-#' @seealso
-#' \url{https://www.ly.gov.tw/Pages/List.aspx?nodeid=153}
-get_bills <- function(start_date = NULL, end_date = NULL, proposer = NULL,
- verbose = TRUE) {
- check_internet()
- api_check(start_date = check_date(start_date), end_date = check_date(end_date))
- validate_dates_format(start_date, end_date)
- set_api_url <- paste("https://www.ly.gov.tw/WebAPI/LegislativeBill.aspx?from=",
- start_date, "&to=", end_date,
- "&proposer=", proposer, "&mode=json", sep = "")
-
- if(isTRUE(verbose)) {
- cat("\nInput Format Information:\n")
- cat("------------------------\n")
- cat("Date format: YYYMMDD (ROC calendar)\n")
- cat("Example: 1090101 for 2020/01/01\n")
- cat("------------------------\n\n")
- cat("Downloading data...\n")
- pb <- txtProgressBar(min = 0, max = 100, style = 3)
- }
-
- tryCatch(
- {
- # 更新進度條到 30%
- if(isTRUE(verbose)) setTxtProgressBar(pb, 30)
-
- with_options(list(timeout = max(1000, getOption("timeout"))),{
- json_df <- jsonlite::fromJSON(set_api_url)
- })
-
- # 更新進度條到 60%
- if(isTRUE(verbose)) setTxtProgressBar(pb, 60)
-
- df <- tibble::as_tibble(json_df)
- attempt::stop_if_all(nrow(df) == 0, isTRUE, msg = "The query is unavailable.")
- df["date_ad"] <- do.call("c", lapply(df$date, transformed_date_bill))
-
- # 更新進度條到 90%
- if(isTRUE(verbose)) setTxtProgressBar(pb, 90)
-
- if(isTRUE(verbose)) {
- setTxtProgressBar(pb, 100)
- close(pb)
- cat("\n\n") # Add newlines after progress bar
- cat("====== Retrieved Information ======\n")
- cat("-----------------------------------\n")
- cat(" Retrieved URL: \n", set_api_url, "\n")
- cat(" Total Unique Proposers:", length(unique(.clean_legislator_names(df$billProposer))), "\n")
- cat(" Retrieved date between:", as.character(check_date(start_date)),
- "and", as.character(check_date(end_date)), "\n")
- cat(" Retrieved Number: ", nrow(df), "\n")
-
- # Add bill statistics
- if(!is.null(df$billProposer)) {
- unique_proposers <- length(unique(.clean_legislator_names(df$billProposer)))
- cat(sprintf(" Total Unique Proposers: %d\n", unique_proposers))
- }
- cat("===================================\n")
- }
-
- list_data <- list("title" = "the records of bill sponsor and co-sponsor",
- "query_time" = Sys.time(),
- "retrieved_number" = nrow(df),
- "proposer" = proposer,
- "start_date_ad" = check_date(start_date),
- "end_date_ad" = check_date(end_date),
- "start_date" = start_date,
- "end_date" = end_date,
- "url" = set_api_url,
- "variable_names" = colnames(df),
- "manual_info" = "https://www.ly.gov.tw/Pages/List.aspx?nodeid=153",
- "data" = df)
- return(list_data)
- },
- error = function(error_message) {
- if(isTRUE(verbose)) {
- close(pb)
- cat("\n")
- }
- message(error_message)
- }
- )
-}
-
-#' @title The Records of Legislation and the Executives Proposals: 委員及政府議案提案資訊
-#'
-#' @author David Liao (davidycliao@@gmail.com)
-#'
-#' @param term A numeric or NULL value. Data is available from the 8th term onwards.
-#' Default is set to 8. 參數必須為數值。資料從第8屆開始,預設值為8。
-#'
-#' @param session_period An integer, numeric, or NULL. Valid options for the session are:
-#' 1, 2, 3, 4, 5, 6, 7, and 8. Default is set to NULL.
-#' 參數必須為數值。
-#' `review_session_info()` provides available session periods based on the Minguo (Taiwan) calendar.
-#'
-#' @param verbose Default value is TRUE. Displays details of the retrieved data, including the number, URL, and computing time.
-#'
-#' @return A list containing:
-#' \item{`title`}{Records of questions answered by the executives}
-#' \item{`query_time`}{Query time}
-#' \item{`retrieved_number`}{Number of observations}
-#' \item{`retrieved_term`}{Retrieved term}
-#' \item{`url`}{Retrieved JSON URL}
-#' \item{`variable_names`}{Variables of the tibble dataframe}
-#' \item{`manual_info`}{Official manual: \url{https://data.ly.gov.tw/getds.action?id=20} or use `get_variable_info("get_bills_2")`}
-#' \item{`data`}{A tibble dataframe with variables such as:
-#' \describe{
-#' \item{`term`}{屆別}
-#' \item{`sessionPeriod`}{會期}
-#' \item{`sessionTimes`}{會次}
-#' \item{`meetingTimes`}{臨時會會次}
-#' \item{`billNo`}{議案編號}
-#' \item{`billName`}{提案名稱}
-#' \item{`billOrg`}{提案單位/委員}
-#' \item{`billProposer`}{主提案人}
-#' \item{`billCosignatory`}{連署提案}
-#' \item{`billStatus`}{議案狀態}
-#' \item{`pdfUrl`}{PDF download link for related documents}
-#' \item{`docUrl`}{DOC download link for related documents}
-#' \item{`selectTerm`}{Filtering criteria based on term}
-#' }
-#' }
-#'
-#' @importFrom attempt stop_if_all
-#' @importFrom jsonlite fromJSON
-#' @importFrom httr GET
-#' @importFrom tibble as_tibble
-#' @importFrom withr with_options
-#'
-#' @export
-#'
-#' @examples
-#' \dontrun{
-#' ## Query the executives' responses by term and session period.
-#' ## 輸入「立委屆期」與「會期」以下載「質詢事項 (行政院答復部分)」
-#' get_bills_2(term = 8, session_period = 1)
-#' }
-#'
-#' @details The `get_bills_2` function produces a list, which includes `query_time`,
-#' `retrieved_number`, `retrieved_term`, `url`, `variable_names`, `manual_info`, and `data`.
-#' For the user manual and more information about the dataframe, use `get_variable_info("get_bills_2")`.
-#'
-#' @note For more details about the dataframe's variables, use `get_variable_info("get_bills_2")`
-#' or visit the API manual at \url{https://data.ly.gov.tw/getds.action?id=20}.
-#' 議事類: 提供委員及政府之議案提案資訊 (從第8屆第1會期開始)。
-#'
-#' @seealso
-#' `get_variable_info("get_bills_2")`,`review_session_info()`
-get_bills_2 <- function(term = 8, session_period = NULL, verbose = TRUE) {
- # Check for internet connectivity
- check_internet()
-
- # Format info at the start
- if(isTRUE(verbose)) {
- cat("\nInput Format Information:\n")
- cat("------------------------\n")
- cat("Term: Must be numeric (e.g., 8, 9, 10, 11)\n")
- cat("Session Period: Must be numeric (1-8)\n")
- cat("------------------------\n\n")
- cat("Downloading legislative bills data...\n")
- pb <- txtProgressBar(min = 0, max = 100, style = 3)
- }
-
- # If the term is not specified
- if (is.null(term)) {
- # Set the base API URL without specifying any term
- set_api_url <- "https://data.ly.gov.tw/odw/ID20Action.action?term=&sessionPeriod=&sessionTimes=&meetingTimes=&billName=&billOrg=&billProposer=&billCosignatory=&fileType=json"
- # Display a notification message
- message("The term is not defined...\nYou are now requesting full data from the API. Please ensure a stable internet connection until completion.\n")
- } else {
- # Update progress bar to 20%
- if(isTRUE(verbose)) setTxtProgressBar(pb, 20)
- # If the term is in character format, stop execution and display an error message
- attempt::stop_if_all(term, is.character, msg = "Please use numeric format only.")
- # If term length is one, format the term to two digits
- if (length(term) == 1) {
- term <- sprintf("%02d", as.numeric(term))
- } else if (length(term) > 1) {
- if(isTRUE(verbose)) close(pb)
- stop("The API doesn't support querying multiple terms. Consider implementing batch processing. Please refer to the tutorial for guidance.")
- }
- # Convert session period to two-digit format, if it's not NULL
- session_str <- ifelse(is.null(session_period), "", sprintf("%02d", as.numeric(session_period)))
- # Construct the complete API URL
- set_api_url <- paste0("https://data.ly.gov.tw/odw/ID20Action.action?term=",
- term, "&sessionPeriod=", session_str,
- "&sessionTimes=&meetingTimes=&billName=&billOrg=&billProposer=&billCosignatory=&fileType=json")
- }
-
- # Update progress bar to 40%
- if(isTRUE(verbose)) setTxtProgressBar(pb, 40)
-
- # Try to fetch the data and process it
- tryCatch(
- {
- with_options(list(timeout = max(1000, getOption("timeout"))),{
- json_df <- jsonlite::fromJSON(set_api_url)
- })
-
- # Update progress bar to 60%
- if(isTRUE(verbose)) setTxtProgressBar(pb, 60)
-
- df <- tibble::as_tibble(json_df$dataList)
-
- # Update progress bar to 80%
- if(isTRUE(verbose)) setTxtProgressBar(pb, 80)
-
- # If the returned data is empty, stop execution and display an error message
- attempt::stop_if_all(nrow(df) == 0, isTRUE, msg = "The query is unavailable.")
-
- # Calculate summary statistics
- total_bills <- nrow(df)
- budget_bills <- if("billName" %in% colnames(df)) sum(grepl("預算", df$billName)) else 0
- budget_percentage <- if(total_bills > 0) (budget_bills / total_bills) * 100 else 0
-
- # Update progress bar to 100%
- if(isTRUE(verbose)) {
- setTxtProgressBar(pb, 100)
- close(pb)
- cat("\n\n") # Add newlines after progress bar
- cat("====== Retrieved Information ======\n")
- cat("-----------------------------------\n")
- cat(" Retrieved URL: \n", set_api_url, "\n")
- if(!is.null(session_period)) {
- cat(" Retrieved Session Period: ", session_period, "\n")
- }
- cat(" Retrieved Term: ", term, "\n")
-
- # Calculate total bills and unique legislators
- total_bills <- nrow(df)
- unique_legislators <- length(unique(.clean_legislator_names(df$billOrg)))
-
- cat(sprintf(" Total Bills: %d\n", total_bills))
- cat(sprintf(" Total Unique Proposers: %d\n", unique_legislators))
- cat("===================================\n")
- # if(isTRUE(verbose)) {
- # setTxtProgressBar(pb, 100)
- # close(pb)
- # cat("\n\n") # Add newlines after progress bar
- # cat("====== Retrieved Information ======\n")
- # cat("-----------------------------------\n")
- # cat(" URL: \n", set_api_url, "\n")
- # cat(" Term: ", term, "\n")
- # if(!is.null(session_period)) {
- # cat(" Session Period: ", session_period, "\n")
- # }
- #
- # # Overall Statistics
- # cat("\nOverall Statistics:\n")
- # cat("-----------------------------------\n")
- # cat(sprintf(" Total Bills: %d\n", total_bills))
- # cat(sprintf(" Budget Bills: %d (%.1f%%)\n", budget_bills, budget_percentage))
- #
- # # Detailed Bill Type Distribution
- # if("billName" %in% colnames(df)) {
- # bill_types <- table(df$billName)
- # cat("\nBill Type Distribution:\n")
- # cat("-----------------------------------\n")
- # for(type in names(bill_types)) {
- # count <- bill_types[type]
- # percentage <- (count / total_bills) * 100
- # cat(sprintf(" %s: %d (%.1f%%)\n", type, count, percentage))
- # }
- # }
- #
- # # Proposer Distribution
- # if("billOrg" %in% colnames(df)) {
- # cat("\nProposer Distribution:\n")
- # cat("-----------------------------------\n")
- # proposer_counts <- table(.clean_legislator_names(df$billOrg))
- # for(proposer in names(proposer_counts)) {
- # count <- proposer_counts[proposer]
- # percentage <- (count / total_bills) * 100
- # if(nchar(trimws(proposer)) > 0) { # Only show non-empty proposers
- # cat(sprintf(" %s: %d (%.1f%%)\n", proposer, count, percentage))
- # }
- # }
- # }
- # cat("===================================\n")
-
- }
-
- # Construct the result list
- list_data <- list(
- "title" = "The records of the questions answered by the executives",
- "query_time" = Sys.time(),
- "retrieved_number" = total_bills,
- "budget_bills" = budget_bills,
- "budget_percentage" = budget_percentage,
- "retrieved_term" = term,
- "url" = set_api_url,
- "variable_names" = colnames(df),
- "manual_info" = "https://data.ly.gov.tw/getds.action?id=2",
- "data" = df
- )
- return(list_data)
- },
- error = function(error_message) {
- if(isTRUE(verbose)) {
- close(pb)
- cat("\n")
- }
- message(error_message)
- }
- )
-}
diff --git a/.Rproj.user/763C8F27/sources/session-ab45fd2f/124B7A66-contents b/.Rproj.user/763C8F27/sources/session-ab45fd2f/124B7A66-contents
deleted file mode 100644
index cc58b737..00000000
--- a/.Rproj.user/763C8F27/sources/session-ab45fd2f/124B7A66-contents
+++ /dev/null
@@ -1,11 +0,0 @@
-^renv$
-^renv\.lock$
-^.*\.Rproj$
-^\.Rproj\.user$
-^\.github$
-^_pkgdown\.yml$
-^docs$
-^pkgdown$
-^doc$
-^Meta$
-^README\.Rmd$
diff --git a/.Rproj.user/763C8F27/sources/session-ab45fd2f/13E9BEE2-contents b/.Rproj.user/763C8F27/sources/session-ab45fd2f/13E9BEE2-contents
deleted file mode 100644
index 0bd0e5f6..00000000
--- a/.Rproj.user/763C8F27/sources/session-ab45fd2f/13E9BEE2-contents
+++ /dev/null
@@ -1,22 +0,0 @@
-MIT License
-
-Copyright (c) 2023 Yen-Chieh Liao
-
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in all
-copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-SOFTWARE.
diff --git a/.Rproj.user/763C8F27/sources/session-ab45fd2f/141FB1EA-contents b/.Rproj.user/763C8F27/sources/session-ab45fd2f/141FB1EA-contents
deleted file mode 100644
index c38f5830..00000000
--- a/.Rproj.user/763C8F27/sources/session-ab45fd2f/141FB1EA-contents
+++ /dev/null
@@ -1,44 +0,0 @@
-# Test infos
-test_that("get_variable_info", {
-expect_error(get_variable_info("x"),
- "Use correct function names below in character format:
- get_bills: the records of the bills
- get_bills_2: the records of legislators and the government proposals
- get_meetings: the spoken meeting records
- get_caucus_meetings: the meeting records of cross-caucus session
- get_speech_video: the full video information of meetings and committees
- get_public_debates: the records of national public debates
- get_parlquestions: the records of parliamentary questions
- get_executive_response: the records of the questions answered by the executives")
-})
-
-
-
-# For get_variable_info function
-test_that("get_variable_info works correctly", {
- result <- get_variable_info("get_bills")
-
- # Check if the function returns a list
- expect_true(is.list(result))
-
- # Check if the list contains specific elements
- expect_true("page_info" %in% names(result))
- expect_true("reference_url" %in% names(result))
-
- # Check if passing an invalid parameter value results in an error
- expect_error(get_variable_info("invalid_function_name"), "Use correct function names below in character format.")
-})
-
-# For review_session_info function
-test_that("review_session_info works correctly", {
- result <- review_session_info(7)
-
- # Check if the function returns a tibble
- expect_true(is(result, "tbl_df"))
-
- # Check if the tibble contains specific column names (this depends on the actual column names)
- expect_true("屆期會期" %in% colnames(result)) # Replace 'ColumnName1' with actual column name
-
- # Check if passing an invalid term value results in an error
- # expect_error(review_session_info(12), "use correct `term`.")
-})
diff --git a/.Rproj.user/763C8F27/sources/session-ab45fd2f/197052BE-contents b/.Rproj.user/763C8F27/sources/session-ab45fd2f/197052BE-contents
deleted file mode 100644
index 4c35a620..00000000
--- a/.Rproj.user/763C8F27/sources/session-ab45fd2f/197052BE-contents
+++ /dev/null
@@ -1,9 +0,0 @@
-^\.github$
-^.*\.Rproj$
-^\.Rproj\.user$
-^_pkgdown\.yml$
-^docs$
-^pkgdown$
-^\.github$
-^codecov\.yml$
-^.*\.utf8\.R$
diff --git a/.Rproj.user/763C8F27/sources/session-ab45fd2f/19A33DFD-contents b/.Rproj.user/763C8F27/sources/session-ab45fd2f/19A33DFD-contents
deleted file mode 100644
index de836bbc..00000000
--- a/.Rproj.user/763C8F27/sources/session-ab45fd2f/19A33DFD-contents
+++ /dev/null
@@ -1,61 +0,0 @@
----
-title: "Legislator's Demographic Data"
-author: ""
-output: rmarkdown::html_vignette
-vignette: >
- %\VignetteIndexEntry{Legislator's Demographic Data}
- %\VignetteEngine{knitr::rmarkdown}
- %\VignetteEncoding{UTF-8}
----
-
-```{r, include = FALSE}
-knitr::opts_chunk$set(
- collapse = TRUE,
- comment = "#>"
-)
-```
-
-```{r include=FALSE}
-assign("has_internet_via_proxy", TRUE, environment(curl::has_internet))
-```
-
-## Using `get_legislators()` as an Example to Fetch Legislator Data
-
-
-The get_legislators() function provides a straightforward way to access Taiwan's legislator data from the official parliamentary database. Here's a step-by-step demonstration:
-
-
-```{r}
-library(legisTaiwan)
-```
-
-
-
-First, we load the legisTaiwan package which contains tools for accessing Taiwan's legislative data.
-
-
-```{r}
-info <- get_legislators(verbose = FALSE)
-```
-
-
-Here, we call get_legislators() and store the results in info. The verbose = FALSE parameter suppresses the progress bar during data fetching. This makes the function run quietly without displaying download progress.
-
-
-```{r}
-info$data
-```
-
-
-
-This command displays the retrieved data which includes comprehensive information about legislators. The returned data frame contains various fields about each legislator, such as:
-
-- Personal information (name, gender, birth date)
-- Electoral district details
-- Party affiliation
-- Committee and more!
-
-Each row represents a unique legislator, making it easy to analyze or extract specific information about Taiwan's parliamentary representatives.
-
-
-
diff --git a/.Rproj.user/763C8F27/sources/session-ab45fd2f/1B61396B-contents b/.Rproj.user/763C8F27/sources/session-ab45fd2f/1B61396B-contents
deleted file mode 100644
index d55a8c0a..00000000
--- a/.Rproj.user/763C8F27/sources/session-ab45fd2f/1B61396B-contents
+++ /dev/null
@@ -1,9 +0,0 @@
-## ----include = FALSE----------------------------------------------------------
-knitr::opts_chunk$set(
- collapse = TRUE,
- comment = "#>"
-)
-
-## ----include=FALSE------------------------------------------------------------
-assign("has_internet_via_proxy", TRUE, environment(curl::has_internet))
-
diff --git a/.Rproj.user/763C8F27/sources/session-ab45fd2f/1E36E487-contents b/.Rproj.user/763C8F27/sources/session-ab45fd2f/1E36E487-contents
deleted file mode 100644
index f0934fc0..00000000
--- a/.Rproj.user/763C8F27/sources/session-ab45fd2f/1E36E487-contents
+++ /dev/null
@@ -1,7 +0,0 @@
-test_that("get_legislators", {
- expect_equal(nrow(get_legislators(term = 2)$data), 165)
- expect_equal(get_legislators(term = 2)$queried_term, "2")
- expect_equal(get_legislators(term = 2, verbose = FALSE)$queried_term, "2")
- expect_equal(get_legislators(term = 8)$queried_term, "8")
- expect_error(get_legislators(term = 30)$queried_term, "Query returned no data.")
- })
diff --git a/.Rproj.user/763C8F27/sources/session-ab45fd2f/1F80FBEC-contents b/.Rproj.user/763C8F27/sources/session-ab45fd2f/1F80FBEC-contents
deleted file mode 100644
index c0dd22f4..00000000
--- a/.Rproj.user/763C8F27/sources/session-ab45fd2f/1F80FBEC-contents
+++ /dev/null
@@ -1,26 +0,0 @@
-# Contributor Code of Conduct
-
-As contributors and maintainers of this project, we pledge to respect all people who
-contribute through reporting issues, posting feature requests, updating documentation,
-submitting pull requests or patches, and other activities.
-
-We are committed to making participation in this project a harassment-free experience for
-everyone, regardless of level of experience, gender, gender identity and expression,
-sexual orientation, disability, personal appearance, body size, race, ethnicity, age, religion,
-or choice of text editor.
-
-Examples of unacceptable behavior by participants include the use of sexual language or
-imagery, derogatory comments or personal attacks, trolling, public or private harassment,
-insults, or other unprofessional conduct.
-
-Project maintainers have the right and responsibility to remove, edit, or reject comments,
-commits, code, wiki edits, issues, and other contributions that are not aligned to this
-Code of Conduct. Project maintainers who do not follow the Code of Conduct may be removed
-from the project team.
-
-Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by
-opening an issue or contacting one or more of the project maintainers.
-
-This Code of Conduct is adapted from the Contributor Covenant
-(http:contributor-covenant.org), version 1.0.0, available at
-http://contributor-covenant.org/version/1/0/0/
diff --git a/.Rproj.user/763C8F27/sources/session-ab45fd2f/20A6C2C5-contents b/.Rproj.user/763C8F27/sources/session-ab45fd2f/20A6C2C5-contents
deleted file mode 100644
index 49210289..00000000
--- a/.Rproj.user/763C8F27/sources/session-ab45fd2f/20A6C2C5-contents
+++ /dev/null
@@ -1,369 +0,0 @@
-#' @title The Records of the Bills: 法律提案
-#'
-#' @param start_date numeric. Must be formatted in the ROC Taiwan calendar, e.g., 1090101.
-#' @param end_date numeric. Must be formatted in the ROC Taiwan calendar, e.g., 1090102.
-#' @param proposer The default value is NULL, indicating that bills proposed by all legislators
-#' are included between the start and end dates.
-#' @param verbose logical. Specifies whether `get_bills` should print out
-#' detailed output when retrieving the data. The default value is TRUE.
-#'
-#' @return A list, which contains:
-#' \describe{
-#' \item{`title`}{Records of cross-caucus sessions}
-#' \item{`query_time`}{Query timestamp}
-#' \item{`retrieved_number`}{Number of observations retrieved}
-#' \item{`meeting_unit`}{Meeting unit}
-#' \item{`start_date_ad`}{Start date in POSIXct format}
-#' \item{`end_date_ad`}{End date in POSIXct format}
-#' \item{`start_date`}{Start date in the ROC Taiwan calendar}
-#' \item{`url`}{URL of the retrieved JSON data}
-#' \item{`variable_names`}{Variable names of the tibble dataframe}
-#' \item{`manual_info`}{Official manual. See \url{https://www.ly.gov.tw/Pages/List.aspx?nodeid=153} or use get_variable_info("get_bills")}
-#' \item{`data`}{A tibble dataframe with the following variables:
-#' \describe{\item{`term`}{Session number}
-#' \item{`sessionPeriod`}{Session period}
-#' \item{`sessionTimes`}{Session count}
-#' \item{`meetingTimes`}{Proposal date}
-#' \item{`billName`}{Bill name}
-#' \item{`billProposer`}{Primary proposer}
-#' \item{`billCosignatory`}{Co-signatories of the bill}
-#' \item{`billStatus`}{Status of the bill}
-#' \item{`date_ad`}{Date in the Gregorian calendar}
-#' }
-#' }
-#' }
-#'
-#' @importFrom httr GET
-#' @importFrom httr content
-#' @importFrom jsonlite fromJSON
-#' @importFrom tibble as_tibble
-#' @importFrom withr with_options
-#'
-#' @export
-#'
-#' @examples
-#' \dontrun{
-#' ## Query bill records by a date range in the Taiwan ROC calendar format
-#' get_bills(start_date = 1060120, end_date = 1070310, verbose = TRUE)
-#'
-#' ## Query bill records by a date range and a specific legislator
-#' get_bills(start_date = 1060120, end_date = 1070310, proposer = "孔文吉")
-#'
-#' ## Query bill records by a date range and multiple legislators
-#' get_bills(start_date = 1060120, end_date = 1060510, proposer = "孔文吉&鄭天財")
-#' }
-#'
-#' @details The `get_bills` function returns a list that contains `query_time`,
-#' `retrieved_number`, `meeting_unit`, `start_date_ad`, `end_date_ad`, `start_date`,
-#' `end_date`, `url`, `variable_names`, `manual_info`, and `data`.
-#'
-#' @note To retrieve the user manual and more details about the data frame, use `get_variable_info("get_bills")`.
-#' Further checks are required as the user manual seems to be inconsistent with the actual data.
-#'
-#' @seealso
-#' \url{https://www.ly.gov.tw/Pages/List.aspx?nodeid=153}
-get_bills <- function(start_date = NULL, end_date = NULL, proposer = NULL,
- verbose = TRUE) {
- check_internet()
- api_check(start_date = check_date(start_date), end_date = check_date(end_date))
- validate_dates_format(start_date, end_date)
- set_api_url <- paste("https://www.ly.gov.tw/WebAPI/LegislativeBill.aspx?from=",
- start_date, "&to=", end_date,
- "&proposer=", proposer, "&mode=json", sep = "")
-
- if(isTRUE(verbose)) {
- cat("\nInput Format Information:\n")
- cat("------------------------\n")
- cat("Date format: YYYMMDD (ROC calendar)\n")
- cat("Example: 1090101 for 2020/01/01\n")
- cat("------------------------\n\n")
- cat("Downloading data...\n")
- pb <- txtProgressBar(min = 0, max = 100, style = 3)
- }
-
- tryCatch(
- {
- # 更新進度條到 30%
- if(isTRUE(verbose)) setTxtProgressBar(pb, 30)
-
- with_options(list(timeout = max(1000, getOption("timeout"))),{
- json_df <- jsonlite::fromJSON(set_api_url)
- })
-
- # 更新進度條到 60%
- if(isTRUE(verbose)) setTxtProgressBar(pb, 60)
-
- df <- tibble::as_tibble(json_df)
- attempt::stop_if_all(nrow(df) == 0, isTRUE, msg = "The query is unavailable.")
- df["date_ad"] <- do.call("c", lapply(df$date, transformed_date_bill))
-
- # 更新進度條到 90%
- if(isTRUE(verbose)) setTxtProgressBar(pb, 90)
-
- if(isTRUE(verbose)) {
- setTxtProgressBar(pb, 100)
- close(pb)
- cat("\n\n") # Add newlines after progress bar
- cat("====== Retrieved Information ======\n")
- cat("-----------------------------------\n")
- cat(" Retrieved URL: \n", set_api_url, "\n")
- cat(" Total Unique Proposers:", length(unique(.clean_names(df$billProposer))), "\n")
- cat(" Retrieved date between:", as.character(check_date(start_date)),
- "and", as.character(check_date(end_date)), "\n")
- cat(" Retrieved Number: ", nrow(df), "\n")
-
- # Add bill statistics
- if(!is.null(df$billProposer)) {
- unique_proposers <- length(unique(.clean_legislator_names(df$billProposer)))
- cat(sprintf(" Total Unique Proposers: %d\n", unique_proposers))
- }
- cat("===================================\n")
- }
-
- list_data <- list("title" = "the records of bill sponsor and co-sponsor",
- "query_time" = Sys.time(),
- "retrieved_number" = nrow(df),
- "proposer" = proposer,
- "start_date_ad" = check_date(start_date),
- "end_date_ad" = check_date(end_date),
- "start_date" = start_date,
- "end_date" = end_date,
- "url" = set_api_url,
- "variable_names" = colnames(df),
- "manual_info" = "https://www.ly.gov.tw/Pages/List.aspx?nodeid=153",
- "data" = df)
- return(list_data)
- },
- error = function(error_message) {
- if(isTRUE(verbose)) {
- close(pb)
- cat("\n")
- }
- message(error_message)
- }
- )
-}
-
-#' @title The Records of Legislation and the Executives Proposals: 委員及政府議案提案資訊
-#'
-#' @author David Liao (davidycliao@@gmail.com)
-#'
-#' @param term A numeric or NULL value. Data is available from the 8th term onwards.
-#' Default is set to 8. 參數必須為數值。資料從第8屆開始,預設值為8。
-#'
-#' @param session_period An integer, numeric, or NULL. Valid options for the session are:
-#' 1, 2, 3, 4, 5, 6, 7, and 8. Default is set to NULL.
-#' 參數必須為數值。
-#' `review_session_info()` provides available session periods based on the Minguo (Taiwan) calendar.
-#'
-#' @param verbose Default value is TRUE. Displays details of the retrieved data, including the number, URL, and computing time.
-#'
-#' @return A list containing:
-#' \item{`title`}{Records of questions answered by the executives}
-#' \item{`query_time`}{Query time}
-#' \item{`retrieved_number`}{Number of observations}
-#' \item{`retrieved_term`}{Retrieved term}
-#' \item{`url`}{Retrieved JSON URL}
-#' \item{`variable_names`}{Variables of the tibble dataframe}
-#' \item{`manual_info`}{Official manual: \url{https://data.ly.gov.tw/getds.action?id=20} or use `get_variable_info("get_bills_2")`}
-#' \item{`data`}{A tibble dataframe with variables such as:
-#' \describe{
-#' \item{`term`}{屆別}
-#' \item{`sessionPeriod`}{會期}
-#' \item{`sessionTimes`}{會次}
-#' \item{`meetingTimes`}{臨時會會次}
-#' \item{`billNo`}{議案編號}
-#' \item{`billName`}{提案名稱}
-#' \item{`billOrg`}{提案單位/委員}
-#' \item{`billProposer`}{主提案人}
-#' \item{`billCosignatory`}{連署提案}
-#' \item{`billStatus`}{議案狀態}
-#' \item{`pdfUrl`}{PDF download link for related documents}
-#' \item{`docUrl`}{DOC download link for related documents}
-#' \item{`selectTerm`}{Filtering criteria based on term}
-#' }
-#' }
-#'
-#' @importFrom attempt stop_if_all
-#' @importFrom jsonlite fromJSON
-#' @importFrom httr GET
-#' @importFrom tibble as_tibble
-#' @importFrom withr with_options
-#'
-#' @export
-#'
-#' @examples
-#' \dontrun{
-#' ## Query the executives' responses by term and session period.
-#' ## 輸入「立委屆期」與「會期」以下載「質詢事項 (行政院答復部分)」
-#' get_bills_2(term = 8, session_period = 1)
-#' }
-#'
-#' @details The `get_bills_2` function produces a list, which includes `query_time`,
-#' `retrieved_number`, `retrieved_term`, `url`, `variable_names`, `manual_info`, and `data`.
-#' For the user manual and more information about the dataframe, use `get_variable_info("get_bills_2")`.
-#'
-#' @note For more details about the dataframe's variables, use `get_variable_info("get_bills_2")`
-#' or visit the API manual at \url{https://data.ly.gov.tw/getds.action?id=20}.
-#' 議事類: 提供委員及政府之議案提案資訊 (從第8屆第1會期開始)。
-#'
-#' @seealso
-#' `get_variable_info("get_bills_2")`,`review_session_info()`
-get_bills_2 <- function(term = 8, session_period = NULL, verbose = TRUE) {
- # Check for internet connectivity
- check_internet()
-
- # Format info at the start
- if(isTRUE(verbose)) {
- cat("\nInput Format Information:\n")
- cat("------------------------\n")
- cat("Term: Must be numeric (e.g., 8, 9, 10, 11)\n")
- cat("Session Period: Must be numeric (1-8)\n")
- cat("------------------------\n\n")
- cat("Downloading legislative bills data...\n")
- pb <- txtProgressBar(min = 0, max = 100, style = 3)
- }
-
- # If the term is not specified
- if (is.null(term)) {
- # Set the base API URL without specifying any term
- set_api_url <- "https://data.ly.gov.tw/odw/ID20Action.action?term=&sessionPeriod=&sessionTimes=&meetingTimes=&billName=&billOrg=&billProposer=&billCosignatory=&fileType=json"
- # Display a notification message
- message("The term is not defined...\nYou are now requesting full data from the API. Please ensure a stable internet connection until completion.\n")
- } else {
- # Update progress bar to 20%
- if(isTRUE(verbose)) setTxtProgressBar(pb, 20)
- # If the term is in character format, stop execution and display an error message
- attempt::stop_if_all(term, is.character, msg = "\nPlease use numeric format only.")
- # If term length is one, format the term to two digits
- if (length(term) == 1) {
- term <- sprintf("%02d", as.numeric(term))
- } else if (length(term) > 1) {
- if(isTRUE(verbose)) close(pb)
- stop("The API doesn't support querying multiple terms. Consider implementing batch processing. Please refer to the tutorial for guidance.")
- }
- # Convert session period to two-digit format, if it's not NULL
- session_str <- ifelse(is.null(session_period), "", sprintf("%02d", as.numeric(session_period)))
- # Construct the complete API URL
- set_api_url <- paste0("https://data.ly.gov.tw/odw/ID20Action.action?term=",
- term, "&sessionPeriod=", session_str,
- "&sessionTimes=&meetingTimes=&billName=&billOrg=&billProposer=&billCosignatory=&fileType=json")
- }
-
- # Update progress bar to 40%
- if(isTRUE(verbose)) setTxtProgressBar(pb, 40)
-
- # Try to fetch the data and process it
- tryCatch(
- {
- with_options(list(timeout = max(1000, getOption("timeout"))),{
- json_df <- jsonlite::fromJSON(set_api_url)
- })
-
- # Update progress bar to 60%
- if(isTRUE(verbose)) setTxtProgressBar(pb, 60)
-
- df <- tibble::as_tibble(json_df$dataList)
-
- # Update progress bar to 80%
- if(isTRUE(verbose)) setTxtProgressBar(pb, 80)
-
- # If the returned data is empty, stop execution and display an error message
- attempt::stop_if_all(nrow(df) == 0, isTRUE, msg = "The query is unavailable.")
-
- # Calculate summary statistics
- total_bills <- nrow(df)
- budget_bills <- if("billName" %in% colnames(df)) sum(grepl("預算", df$billName)) else 0
- budget_percentage <- if(total_bills > 0) (budget_bills / total_bills) * 100 else 0
-
- # Update progress bar to 100%
- if(isTRUE(verbose)) {
- setTxtProgressBar(pb, 100)
- close(pb)
- cat("\n\n") # Add newlines after progress bar
- cat("====== Retrieved Information ======\n")
- cat("-----------------------------------\n")
- cat(" Retrieved URL: \n", set_api_url, "\n")
- if(!is.null(session_period)) {
- cat(" Retrieved Session Period: ", session_period, "\n")
- }
- cat(" Retrieved Term: ", term, "\n")
-
- # Calculate total bills and unique legislators
- total_bills <- nrow(df)
- unique_legislators <- length(unique(.clean_names(df$billOrg)))
-
- cat(sprintf(" Total Bills: %d\n", total_bills))
- cat(sprintf(" Total Unique Proposers: %d\n", unique_legislators))
- cat("===================================\n")
- # if(isTRUE(verbose)) {
- # setTxtProgressBar(pb, 100)
- # close(pb)
- # cat("\n\n") # Add newlines after progress bar
- # cat("====== Retrieved Information ======\n")
- # cat("-----------------------------------\n")
- # cat(" URL: \n", set_api_url, "\n")
- # cat(" Term: ", term, "\n")
- # if(!is.null(session_period)) {
- # cat(" Session Period: ", session_period, "\n")
- # }
- #
- # # Overall Statistics
- # cat("\nOverall Statistics:\n")
- # cat("-----------------------------------\n")
- # cat(sprintf(" Total Bills: %d\n", total_bills))
- # cat(sprintf(" Budget Bills: %d (%.1f%%)\n", budget_bills, budget_percentage))
- #
- # # Detailed Bill Type Distribution
- # if("billName" %in% colnames(df)) {
- # bill_types <- table(df$billName)
- # cat("\nBill Type Distribution:\n")
- # cat("-----------------------------------\n")
- # for(type in names(bill_types)) {
- # count <- bill_types[type]
- # percentage <- (count / total_bills) * 100
- # cat(sprintf(" %s: %d (%.1f%%)\n", type, count, percentage))
- # }
- # }
- #
- # # Proposer Distribution
- # if("billOrg" %in% colnames(df)) {
- # cat("\nProposer Distribution:\n")
- # cat("-----------------------------------\n")
- # proposer_counts <- table(.clean_legislator_names(df$billOrg))
- # for(proposer in names(proposer_counts)) {
- # count <- proposer_counts[proposer]
- # percentage <- (count / total_bills) * 100
- # if(nchar(trimws(proposer)) > 0) { # Only show non-empty proposers
- # cat(sprintf(" %s: %d (%.1f%%)\n", proposer, count, percentage))
- # }
- # }
- # }
- # cat("===================================\n")
-
- }
-
- # Construct the result list
- list_data <- list(
- "title" = "The records of the questions answered by the executives",
- "query_time" = Sys.time(),
- "retrieved_number" = total_bills,
- "budget_bills" = budget_bills,
- "budget_percentage" = budget_percentage,
- "retrieved_term" = term,
- "url" = set_api_url,
- "variable_names" = colnames(df),
- "manual_info" = "https://data.ly.gov.tw/getds.action?id=2",
- "data" = df
- )
- return(list_data)
- },
- error = function(error_message) {
- if(isTRUE(verbose)) {
- close(pb)
- cat("\n")
- }
- message(error_message)
- }
- )
-}
diff --git a/.Rproj.user/763C8F27/sources/session-ab45fd2f/214A8A93-contents b/.Rproj.user/763C8F27/sources/session-ab45fd2f/214A8A93-contents
deleted file mode 100644
index 7f842c9c..00000000
--- a/.Rproj.user/763C8F27/sources/session-ab45fd2f/214A8A93-contents
+++ /dev/null
@@ -1,49 +0,0 @@
----
-title: "Quick Start"
-output: rmarkdown::html_vignette
-vignette: >
- %\VignetteIndexEntry{Quick Start}
- %\VignetteEngine{knitr::rmarkdown}
- %\VignetteEncoding{UTF-8}
----
-
-```{r, include = FALSE}
-knitr::opts_chunk$set(
- collapse = TRUE,
- comment = "#>"
-)
-```
-
-## Get Started with Using [`remotes`](https://github.com/r-lib/remotes):
-
-
-
-**`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.
-
-
-
-
-```{r eval = FALSE}
-install.packages("remotes")
-remotes::install_github("davidycliao/legisTaiwan", force = TRUE)
-```
-
-```{r}
-library(legisTaiwan)
-```
-
-
-
------
-
-
-
-## How to Contribute
-
-
-Contributions in the form of comments, code suggestions, and tutorial examples are very welcome. Please note that the `LeigsTaiwan` is released with the [Contributor Code of Conduct](https://github.com/davidycliao/legisTaiwan/blob/master/CONDUCT.md). By contributing to this project, you agree to abide by its terms.
-
-
-
-
diff --git a/.Rproj.user/763C8F27/sources/session-ab45fd2f/2290E898-contents b/.Rproj.user/763C8F27/sources/session-ab45fd2f/2290E898-contents
deleted file mode 100644
index 86e36a69..00000000
--- a/.Rproj.user/763C8F27/sources/session-ab45fd2f/2290E898-contents
+++ /dev/null
@@ -1,1489 +0,0 @@
-八二三砲戰
-托育
-眷村改建
-遷村
-九二一
-金融卡
-日間托老
-長照
-地震
-偏鄉
-九二一
-大地震
-重建工作
-眷村戶
-公保
-中國行
-紅毛村
-集集
-擴大內需
-不肖商人
-農民生計
-緊急質詢
-優待
-地方繁榮
-進口關稅
-委員會審查
-經濟政策
-嚴重災害
-茂林鄉
-文化整合問題
-兩岸直航
-兩岸海運
-第三地
-轉運中心
-山地鄉
-飲用水
-仁愛鄉
-在台
-鮮蚵
-紅毛港
-令人懷疑
-快速道路
-經濟作物
-高雄捷運
-緊急
-大學學費
-經濟支柱
-彰濱工業區
-農漁民生計天然災害
-補助經費
-災害補助
-全世界排名
-亞太營運中心
-低收入戶
-中低收入戶
-特向
-受災戶
-眷村
-住宅補助
-經濟發展
-敬老津貼
-敬老補助
-偏鄉
-托育
-長照
-
-危老建築
-危老條例
-社工師
-專案進口
-精神障礙
-房地合一
-身心障礙
-時力
-全民動員
-強制治療
-狼師
-超思
-租金補貼
-兼任教師
-廢棄物
-緊急授權
-公費施打
-防疫保單
-不當管教
-全動法
-公關公司
-關務
-便捷化
-關稅
-疫苗護照
-少子化
-外送員
-六大核心產業
-5G
-紅色代理人
-營業秘密
-汽燃費
-數位發展部
-數發部
-新聞議價
-最低標
-最有利標
-契約範本
-餘屋
-囤房
-外傘頂洲
-洋香瓜
-早療
-缺藥
-時代力量
-囤房
-兒少性剝削
-全民共享
-租賃專法
-還稅於民
-國安基金
-國發基金
-國科會
-基本薪資
-疫後條例
-國家重點領域產學合作及人才培育創新條例
-都市危險及老舊建築物加速重建條例
-私密影像
-職能治療師
-物理治療師
-公共出借權
-非自用住宅
-中天
-人工智慧
-監護處分
-保安處分
-學習歷程檔案
-學習歷程
-非法移工
-思覺失調
-社安網
-社會照顧
-兒少性剝削防制條例
-同性婚姻
-婚姻平權
-性別意識
-檢察總長
-同婚
-第七四八號
-第748號
-PCR
-貧富差距
-政治暴力創傷
-促參法
-勞工檢查
-建管
-指揮中心
-防疫指揮中心
-卡蛋
-外國專業人才
-遠距醫療
-健保基金
-健保給付
-強制治療
-強制住院
-電子菸
-不在籍
-科技部
-CDC
-建築管理
-勞資糾紛
-就安基金
-諾富特
-事業單位
-外送平台
-長照體系
-十八歲公民權
-道交條例
-商務人士來臺
-智慧建築標章
-軍售
-耐震標章
-氣候變遷
-三倍券
-五倍券
-振興券
-主計總處
-社區支持
-社區治療
-NCC
-美豬
-美牛
-不當對待
-教保人員
-BOT
-PFI
-BTO
-金融穩定法
-NFT
-加密貨幣
-飛彈
-網銀
-漢翔
-外役監
-國營公司
-海巡艇
-地制法
-戰狼外交
-拜登
-國營企業
-親密關係
-親密關係暴力
-數位性暴力
-N號房
-居住三箭
-退撫基金
-iWIN
-偵查不公開
-性私密影像
-性暴力
-平戰轉換
-巡防艦
-巡防艇
-亞太經合組織
-世界貿易組織
-經濟合作組織
-家庭暴力
-網路銀行
-數位銀行
-資料開放
-中正紀念堂
-公股銀行
-公家銀行
-民間銀行
-海洋發電
-風力發電
-水力發電
-燃煤發電
-火力發電
-用愛發電
-綠電
-漁電共生
-房地產
-東沙群島
-免疫橋接
-信保基金
-央行總裁
-阿共仔
-錢櫃
-AZ
-數位身分證
-165專線
-反詐騙專線
-LNG船
-產業升級
-電子錢包
-循環經濟
-特別預算
-離岸風電
-浮式風機
-高端疫苗
-產業轉型
-財團法人
-智慧農業
-智慧機械
-智慧生醫
-外國專業人才專法
-勞動力缺口
-三接
-產業升級轉型
-供五停二
-豬肉
-動保法
-遊蕩犬貓
-流浪貓狗
-流浪狗貓
-特定寵物業
-國營事業
-新劑型製藥
-多層次傳銷
-多元成家
-性別友善
-同志友善
-特殊教育法
-農業主管機關同意農業用地變更使用審查作業要點
-農產業群聚
-農林22條
-惠臺措施
-惠臺政策
-多層次傳銷法
-儲能產業
-供應鏈
-工輔法
-中南部
-無薪假
-不實資訊
-傳產
-芒果乾
-募兵制
-資訊揭露
-軍審法
-核廢水
-國務機要費
-蔣委員長
-會計法
-直銷詐騙
-傳保會
-新南向
-溫管法
-後備軍人
-向德恩
-全民動員準備
-豬肉
-氫能
-中資
-裴洛西
-電子干擾
-傳統產業
-經濟合作
-榮家
-農漁會
-兵推
-海底電纜
-全民國防手冊
-RCEP
-孔子學院
-獵狐專案
-武力犯臺
-5+2產業
-APEC
-拜習會
-臺灣獨立
-通膨
-臺獨
-碳排放
-溫室氣體
-溫室效應
-台獨
-能源轉型
-數位轉型
-印太戰略
-一帶一路
-漢光演習
-建築用地
-農業用地
-路政司
-產銷調節
-物價聯合稽核小組
-物價小組
-廣告不實
-虛偽不實
-認知戰
-認知作戰
-學校法人及其所屬私立學校教職員退休撫卹離職資遣條
-食安
-斷交
-過境外交
-南海主權
-電子支付
-行動支付
-缺工
-人力缺口
-物聯網
-互聯網
-退伍軍人
-農保
-長照殺人
-學校衛生法
-海委會
-清冠一號
-三級警戒
-不對稱
-行政程序
-長榮
-比特幣
-娛樂稅
-區塊鏈
-原能會
-工業用電
-國機國造
-國防自主
-產創條例
-會員國
-境外勢力
-公廣
-華視
-資安
-警械使用條例
-metoo
-觀察員
-陸軍司令部
-泰北孤軍
-潛艦國造
-臺鐵
-意識形態
-藻礁
-農發條例
-基層勞工
-警消
-金錢外交
-過境外交
-全民皆兵
-全民國防
-兵棋推演
-現役軍人
-基層員警
-國際接軌
-公投綁大選
-萊豬
-缺水
-國氣國運
-國氣國管
-中油
-核食
-退撫基金
-公安
-公共安全
-公共衛生
-司改國是會議
-國是會議
-社會安全網
-司法改革
-年金改革
-勞保年金
-軍公教
-軍公教警
-口罩外交
-退休
-境外管制
-邊境管制
-潛在負債
-EUA
-公務人員協會
-釋憲
-F-22
-F-16
-F-35
-溫暖內閣
-網路攻擊
-愛國者飛彈
-海洋文化
-義警
-國家公園
-語言能力
-管委會
-城中城
-族語學習
-族語認證
-語言能力
-不當黨產
-經濟海域
-詐騙集團
-消防弟兄
-應考率
-社會住宅
-社宅
-附隨組織
-囤房
-武漢肺炎
-非洲豬瘟
-臺澎金馬
-非法越界
-黨產會
-貿易協定
-缺蛋
-傳統領域
-人口政策
-客家委員會
-客委會
-收歸國有
-包租代管
-第四權
-實價登錄
-租屋補助
-青年補助
-租屋補貼
-海巡署
-海巡弟兄
-循環經濟
-公民投票
-政治獻金
-六都
-習近平
-中選會
-基層員警
-高房價
-公共設施
-消防弟兄
-超前部署
-中華郵政
-言論自由
-公共工程
-美日安保條約
-安保條約
-藝FUN券
-動滋券
-兒少權法
-兒權法
-托育專法
-淨零排放
-高鐵延伸
-代理教師
-居住正義
-公司化
-太魯閣號
-EPS
-主權基金
-夕陽產業
-科研計畫
-性平比例
-生理用品
-特殊教育學校
-特殊教育
-身權公約
-特教
-特殊學校
-全動署
-東協
-電子圍籬
-紓困
-因公殉職
-居家隔離
-陸資
-港資
-第三航廈
-柯文哲
-鏡電視
-柯市長
-謝立功
-謝市長
-環評
-WHA
-全民防衛動員
-全民動員
-東部快鐵計畫
-川普
-太魯閣號事件
-俄烏戰爭
-烏俄戰爭
-價格標
-有利標
-GDP
-萊劑
-萊克多巴胺
-食安法
-3+11
-私校
-私校退場
-前瞻計畫
-前瞻預算
-自主隔離
-蔡總統
-蘇花改
-蘇花安
-中國大陸
-社區發展協會
-原住民族博物館
-金馬影展
-特種基金
-地方政府預算
-核能發電後端營運基金
-性別平等
-性別歧視
-同婚專法
-性別平等工作法
-性別工作平等法
-性別工作平等會
-性別平等教育法
-性別教育平等法
-性平會
-轉型正義
-失聯移工
-營養午餐
-台61線
-娛樂稅
-文策院
-文化內容策進院
-王子維
-性別事件
-性平小組
-調查小組
-改隸
-UberEats
-Uber Eats
-羽球協會
-影視及流行音樂產業局
-新冠肺炎
-COVID
-防疫人員
-醫事人員
-公建計畫
-公建
-性私密影像
-偏遠地區學校教育發展條例
-非山非市
-偏遠地區
-地方創生
-陳椒華
-邱顯智
-洪孟楷
-張其祿
-楊瓊瓔
-曾銘宗
-王婉諭
-鍾佳濱
-高嘉瑜
-李德維
-李貴敏
-邱臣遠
-林奕華
-賴香伶
-孔文吉
-江永昌
-劉世芳
-林德福
-范雲
-吳玉琴
-廖婉汝
-陳以信
-邱志偉
-高虹安
-賴士葆
-溫玉霞
-蔡易餘
-江啟臣
-蔡壁如
-林楚茵
-劉建國
-黃國書
-湯蕙禎
-郭國文
-謝衣鳯
-吳怡玎
-莊瑞雄
-賴惠員
-洪申翰
-鄭正鈐
-羅致政
-呂玉玲
-賴品妤
-賴瑞隆
-羅美玲
-黃世杰
-林思銘
-吳斯懷
-何欣純
-陳亭妃
-王美惠
-吳思瑤
-翁重鈞
-黃國書
-萬美玲
-林宜瑾
-張宏陸
-沈發惠
-林為洲
-游毓蘭
-鄭麗文
-管碧玲
-鄭運鵬
-蘇巧慧
-陳秀寳
-陳明文
-林俊憲
-陳玉珍
-張育美
-何志偉
-趙天麟
-李昆澤
-王定宇
-張廖萬堅
-蘇治芬
-陳素月
-蔡適應
-林淑芬
-費鴻泰
-莊競程
-魯明哲
-陳歐珀
-邱議瑩
-吳秉叡
-羅明才
-陳瑩
-馬文君
-蔣萬安
-許智傑
-高金素梅
-黃秀芳
-陳柏惟
-徐志榮
-趙正宇
-陳超明
-楊曜
-蘇震清
-陳雪生
-柯建銘
-林靜儀
-傅崐萁
-人口販運防制法
-中華民國刑法
-組織犯罪防制條例
-就業服務法
-投資經營非我國籍漁船管理條例
-貿易法
-遠洋漁業條例
-遠洋漁業
-平均地權
-平均地權條例
-不動產經紀業管理條例
-地政士法
-租賃住宅市場發展及管理條例
-跟蹤騷擾防制法
-跟騷法
-性騷擾防治法
-性騷擾
-社會秩序維護法
-消防設備人員法
-消防法
-建築法
-公寓大廈管理條例
-幼兒教育及照顧法
-幼教法
-總統副總統選舉罷免法
-選罷法
-公職人員選舉罷免法
-公民不在籍投票法
-公民投票法
-公投
-住宅法
-房屋稅條例
-土地稅法
-中華民國憲法增修條文
-土地徵收條例
-所得稅法
-都市計畫法
-青年發展基本法
-中華民國憲法增修條文
-公職人員選舉罷免法
-總統副總統選舉罷免法
-中華民國憲法
-原住民
-原住民族基本法
-原住民族健康法
-地方制度法
-原住民身分法
-礦業法
-中華民國憲法增修條文
-原住民保留地開發管理條例
-原住民族教育法
-軍事管制區
-原住民族工作權保障法
-槍砲彈藥刀械管制條例
-公職人員選舉罷免法
-原住民族自治暫行條例
-災害防救法
-環境影響評估法
-老人福利法
-行政院原住民族委員會文化園區管理局組織條例
-促進轉型正義外來政權統治原住民族時期原住民受損權利回復及補償條例
-促轉會
-不義遺址
-私校合併
-原住民族土地及海域法
-原住民族學校法
-國家安全法
-姓名條例
-中央選舉委員會組織法
-全民健康保險法
-勞工保險條例
-國家公園法
-教育基本法
-森林法
-社會救助法
-老年農民福利津貼暫行條例
-行政院原住民族委員會組織條例
-財團法人原住民族文化事業基金會設置條例
-鐵路法
-中高齡者及高齡者就業促進法
-交通部觀光署組織法
-促進轉型正義條例
-傳染病防治法
-內政部國家公園署組織法
-勞工退休金條例
-原住民保留地禁伐補償條例
-原住民族互助金庫條例
-原住民族土地利用諮商同意參與條例
-原住民族土地及海域調查處理委員會組織法
-原住民族委員會土地署組織法
-原住民族學校發展中心設置條例
-原住民族狩獵用槍枝彈藥許可與管理條例
-口腔健康法
-國土計畫法
-國家風景區管理處組織通則
-國民年金法
-國民法官
-國營事業管理法
-國軍退除役官兵輔導條例
-土地法
-土石採取法
-大眾捷運法
-宣誓條例
-就業服務法
-就服法
-平埔族群基本法
-建築法
-憲法訴訟法
-殯葬管理條例
-民族及族群平等法
-社會福利基本法
-社福法
-總統副總統宣誓條例
-總統副總統選舉罷免法
-諮商及取得原住民族或部落同意或參與條例
-都會原住民保障條例
-野生動物保育法
-離島建設條例
-著作權法
-商標法
-專利法
-世界台商綜合園區設置管理條例
-漁業法
-濫發商業電子郵件管理條例
-貿易法
-全民防衛動員準備法
-後備軍人召集優待條例
-替代役實施條例
-國防部全民防衛動員署組織法
-國防部參謀本部組織法
-保全業法
-兵役法
-國防部組織法
-妨害兵役治罪條例
-眷村文化保存及發展條例
-國軍老舊眷村改建條例
-陸海空軍軍官士官服役條例
-全民健康保險法
-太空發展法
-大眾捷運法
-核子事故緊急應變法
-鐵路法
-電信管理法
-傳染病防治法
-公路法
-民用航空法
-氣象法
-醫療法
-商港法
-天然氣事業法
-期貨交易法
-水利法
-產業創新條例
-石油管理法
-自來水法
-證券交易法
-郵政法
-銀行法
-電業法
-公司法
-證券交易法
-食農教育法
-學校午餐促進條例
-國民營養法
-農村再生條例
-數位發展部組織法
-行政院組織法
-國家通訊傳播委員會組織法
-審計部組織法
-數位發展部資通安全署組織法
-公平交易法
-國家科學及技術委員會組織法
-數位發展部數位產業署組織法
-數位經濟基本法
-土石採取法
-中華民國專屬經濟海域及大陸礁層法
-臺灣地區與大陸地區人民關係條例
-農民退休儲金條例
-農民退休
-農業保險法
-離島建設條例
-全民健康保險法
-國民營養法
-行政程序法
-營造業法
-交通部公路局組織法
-交通部民用航空局組織法
-交通部觀光署組織法
-人民團體法
-內政部國家公園署組織法
-公益彩券發行條例
-再生能源發展條例
-地方制度法
-學校午餐促進條例
-就業服務法
-戰地政務期間中共炮宣彈傷亡補償條例
-教育基本法
-菸酒稅法
-外國專業人才延攬及僱用法
-國籍法
-教育部體育署組織法
-入出國及移民法
-新經濟移民法
-國家中山科學研究院設置條例
-教育部組織法
-科技產業園區設置管理條例
-動物保護法
-中華民國憲法增修條文
-野生動物保育法
-內政部警政署組織法
-公寓大廈管理條例
-懲治走私條例
-民法第二編債
-災害防救法
-信託法
-遺產及贈與稅法
-所得稅法
-文化資產保存法
-運動彩券發行條例
-運彩條例
-公益彩券發行條例
-貨物稅條例
-財政收支劃分法
-所得稅法
-太空發展法
-國家太空中心設置條例
-國防法
-勞動教育促進法
-勞促法
-教育部組織法
-高級中等學校建教合作實施及建教生權益保障法
-國民教育法
-運動產業發展條例
-公務員服務法
-海洋產業發展條例
-運動彩券發行條例
-體育部組織法
-文化資產保存法
-眷村文化保存及發展條例
-國立臺灣文學館組織法
-國立臺灣歷史博物館組織法
-全民健康保險法
-太空發展法
-大眾捷運法
-核子事故緊急應變法
-鐵路法
-電信管理法
-傳染病防治法
-公路法
-民用航空法
-氣象法
-醫療法
-商港法
-天然氣事業法
-期貨交易法
-水利法
-產業創新條例
-石油管理法
-自來水法
-證券交易法
-郵政法
-銀行法
-電業法
-道路交通管理處罰條例
-交通安全基本法
-家庭教育法
-兒童及少年福利與權益保障法
-使用牌照稅法
-停車場法
-住宅法
-公寓大廈管理條例
-貨物稅條例
-道路交通管理處罰條例
-強制汽車責任保險法
-公路法
-建築法
-鐵路法
-交通部鐵道局組織法
-國營臺灣鐵路股份有限公司設置條例
-政府採購法
-中華民國刑法
-社會秩序維護法
-政府採購法
-文化藝術獎助及促進條例
-產業創新條例
-道路交通管理處罰條例
-中華民國刑法
-陸海空軍刑法
-刑事訴訟法
-菸酒管理法
-公務人員考績法
-社會秩序維護法
-兵役法
-道路交通管理處罰條例
-文化創意產業發展法
-運動產業發展條例
-社會秩序維護法
-國民體育法
-外役監條例
-中華民國刑法
-法務部司法官學院組織法
-法務部法醫研究所組織條例
-法官法
-刑事訴訟法
-兒童及少年性剝削防制條例
-司法人員人事條例
-少年及家事法院組織法
-少年觀護所設置及實施通則
-性侵害犯罪防治法
-道路交通管理處罰條例
-鄉鎮市調解條例
-公職人員選舉罷免法
-公職人員利益衝突迴避法
-公職人員選罷法
-公設辯護人條例
-刑事補償法
-國家情報工作法
-少年矯正學校設置及教育實施通則
-戒治處分執行條例
-法院組織法
-犯罪被害人
-社區治療
-犯罪被害人權益保障法
-總統副總統選舉罷免法
-行政法院組織法
-軍事審判法
-中華民國刑法
-刑事訴訟法
-保安處分執行法
-精神衛生法
-法務部組織法
-民法第一編總則
-人民團體法
-動物保護法
-兒童及少年福利與權益保障法
-幼兒教育及照顧法
-民法第四編親屬
-農會法
-保全業法
-家庭暴力防治法
-民法親屬編施行法
-漁會法
-零售市場管理條例
-人口
-國庫
-物價
-經濟循環
-經濟政務
-標準
-談判
-經濟政策
-經濟發展
-經濟建設
-財政政務
-財政政策
-貨幣
-通貨膨脹
-進口管制
-賦稅
-對外投資
-對外經濟關係
-產業政策
-產業發展
-中小企業
-公共建設
-加工出口
-工業
-人權保障
-性別歧視
-國有財產
-同性戀
-政治迫害
-原住民族
-地方語言
-族群意識
-客家事務
-婦女受害者
-原民權利
-司法改革
-原民事務
-原民政策
-原民財經
-全民健保
-公共衛生
-動物疾病
-國民健康
-疾病管制
-檢驗
-管制藥品
-原民衛福
-全民健保
-衛福政務
-肉品衛生
-食品管理
-衛福其他
-食品衛生
-醫政
-防檢檢疫
-體檢
-中醫藥
-毒物管理
-安全衛生
-衛福政策
-農保
-農地
-農業人口
-農業政務
-農業政策
-農民
-農民輔導
-農漁金融
-農產品價格
-農產運銷
-農糧
-畜牧
-畜牧業
-人力資源
-人力運用
-休假
-加班
-勞動其他
-退休金
-退職
-退輔
-退休撫卹
-勞動基準
-勞動政務
-勞動政策
-勞工權益
-勞工福利
-勞資關係
-外國人
-外國人投資
-就業
-工作時間
-年金保險
-待遇福利
-流動勞工
-薪資
-薪資調整
-罷工
-工廠管理
-工程管理
-中等教育
-人才培育
-人才外流
-大學
-學前教育
-學生事務
-教師
-國民教育
-原民文教
-學生活動
-師範教育
-技職教育
-技術教育
-特殊教育
-社會教育
-職業教育
-原住民族教育
-體育
-高等教育
-教育人員
-教育其他
-教育政務
-教育政策
-青年輔導
-中研院
-建教合作
-噪音振動
-土地品質
-土壤污染
-地層下陷
-大氣空氣
-大氣污染
-大氣空氣
-太陽能
-環境影響評估
-環境政務
-環境衛生
-環境評估
-空氣污染
-空氣污染防治
-消防防災
-空氣污染防治
-環境政務
-環境影響評估
-環境政策
-環境衛生
-生態保育
-廢棄物
-廢氣管制
-再生能源
-天然氣
-核能政策
-核能發電廠
-火力發電
-火力發電廠
-煤
-能源
-能源政策
-電力
-電力公司
-電力生產
-電動車輛
-核能
-電費
-移民
-外國人
-外國人投資
-交通政務
-交通政策
-公路
-加工出口
-港埠
-海運,
-空中勤務
-空運
-運輸規劃
-鐵路
-鐵路建設
-鐵路運輸
-網際網路
-交通其他
-刑事
-司法其他
-司法改革
-司法政策
-大法官
-利益迴避
-憲政改革
-憲政議題
-憲政運作
-憲法
-憲法修正
-引渡
-檢察事務
-司法行政
-夫妻
-婚姻
-法務其他
-法務政務
-法律事務
-特赦
-民事
-法院
-犯罪被害人保護
-矯正事務
-行政法
-訴訟法
-調查工作
-調查巡察
-社政
-福利服務
-社區
-都市計畫
-社會發展
-營建
-保險
-公平交易
-商業
-投資
-保護業務
-財金其他
-投資業務
-證券市場
-證券期貨
-金融
-銀行
-消費保護
-作戰訓練
-兵役政策
-國防
-國防主計
-國防人事
-國防其他
-海軍
-役政
-徵兵
-國防政務
-國防政策
-戰爭
-戰略
-軍事審判
-軍事演習
-軍事科學
-軍人退休俸
-軍備
-軍醫
-飛行員
-空中勤務
-科學園區
-科技交流
-科技政務
-科技政策
-科技研發
-電信
-技術移轉
-智慧財產
-關務
-經濟合作
-經貿其他
-貿易協定
-貿易政策
-自由貿易區
-對外貿易
-亞太
-亞西非洲
-僑務
-僑民文教
-中美洲
-僑民經濟
-北美
-外交其他
-外交政務
-外交政策
-外交關係
-國際協定
-國際合作
-國際文教
-國際環保
-國際環境保護
-國際組織
-國際經濟
-國際貿易
-國際關係
-歐洲
-歐洲聯盟
-國際新聞
-入出國
-入出境管理
-主權
-主計事務
-人事事務
-總統選舉
-締約權
-總統職權
-總統選舉
-國有財產
-國民身分證
-內政其他
-內政政策
-總統選罷
-總統其他
-戶籍
-人民團體
-內政政務
-監察行政
-黨政關係
-人事其他
-人事行政
-任免升遷
-公共政策
-公務員俸給
-戶政
-遴選制度
-公務員福利
-公務員退休
-公教人員出國
-公民投票
-公營事業
-公立學校
-國會
-國會決議
-國家元首
-國家安全
-國家政策
-國發政務
-訓練進修
-外匯
-政務官
-政府出版
-政府採購
-政府施政
-政府組織
-政府資訊
-政府體制
-政治作戰
-政治獻金
-政治革新
-政治體制
-政風工作
-文官制度
-普查抽樣
-會計
-民意調查
-決算
-監察院
-研究發展
-組織編制
-經濟建設
-遴選制度
-考核獎懲
-考試分發
-考試制度
-考試行政
-行政協調
-行政責任
-行政首長
-民政
-財產申報
-資源分配
-質詢權
-選務
-選舉
-領務
-警政
-警察
-總統禮遇
-領海
-預算
-任免升遷
-黨政關係
-立委選罷
-立法
-審計
-蒙藏事務
-立法其他
-立法委員
-立法行政
-立法院
-立院職權
-糾正案
-彈劾糾舉
-地政
-國土計畫
-領土
-水利
-水土保持
-水源水質
-水資源
-污染防治
-土地使用
-原民土地
-供水
-海域安全
-海洋事務
-海洋政策
-海洋文教
-海洋科研
-海洋資源
-漁業
-漁業權
-林業
-漁業管理
-漁產品
-漁船
-礦業地質
-藥政
-領海
-體育
-文化交流
-文化傳播
-文化其他
-文化政務
-紀念館
-客家傳播
-文化政策
-客家政策
-客家文教
-客家社經
-文化設施
-文化資產
-文創發展
-母語教學
-社區
-藝術發展
-觀光
-電影
-電視廣播
-文化認同
-語言
-和平主義
-基金
-臺獀
-強權政治
-檔案管理
-臺獀
-談判
-國內新聞
-郵政
-出版
-傳播媒體
-全國統計
-臺獨
-氣象
-兩岸政務
-兩岸文教
-兩岸法政
-兩岸經貿
-港澳事務
-大陸協商
-大陸政策
-中共研究
-中國問題
\ No newline at end of file
diff --git a/.Rproj.user/763C8F27/sources/session-ab45fd2f/27189F62-contents b/.Rproj.user/763C8F27/sources/session-ab45fd2f/27189F62-contents
deleted file mode 100644
index dde8c8e6..00000000
--- a/.Rproj.user/763C8F27/sources/session-ab45fd2f/27189F62-contents
+++ /dev/null
@@ -1,949 +0,0 @@
-#'@title The Spoken Meeting Records 委員發言
-#'
-#'@author David Liao (davidycliao@@gmail.com)
-#'
-#'@param start_date numeric Must be formatted in Minguo (Taiwan) calendar, e.g. 1090101.
-#'
-#'@param end_date numeric Must be formatted in Minguo (Taiwan) calendar, e.g. 1090102.
-#'
-#'@param meeting_unit NULL The default is NULL, which includes all meeting types
-#' between the starting date and the ending date.
-#'
-#'@param verbose logical, indicates whether `get_meetings` should print out
-#'detailed output when retrieving the data.
-#'
-#'@return list, which contains: \describe{
-#' \item{`title`}{the spoken meeting records }
-#' \item{`query_time`}{the query time}
-#' \item{`retrieved_number`}{the number of the observation}
-#' \item{`meeting_unit`}{the meeting unit}
-#' \item{`start_date_ad`}{the start date in POSIXct}
-#' \item{`end_date_ad`}{the end date in POSIXct}
-#' \item{`start_date`}{the start date in ROC Taiwan calendar}
-#' \item{`url`}{the retrieved json url}
-#' \item{`variable_names`}{the variables of the tibble dataframe}
-#' \item{`manual_info`}{the offical manual, \url{https://www.ly.gov.tw/Pages/List.aspx?nodeid=154}; or use get_variable_info("get_meetings")}
-#' \item{`data`}{a tibble dataframe, whose variables include:
-#' \describe{\item{`smeeting_date`}{會議日期}
-#' \item{`meeting_status`}{會議狀態}
-#' \item{`meeting_name`}{會議名稱}
-#' \item{`meeting_content`}{會議事由}
-#' \item{`speechers`}{委員發言名單}
-#' \item{`meeting_unit`}{主辦單位}
-#' \item{`date_ad`}{西元年}
-#' }
-#' }
-#' }
-#'
-#'@importFrom attempt stop_if_all
-#'@importFrom jsonlite fromJSON
-#'@importFrom withr with_options
-#'
-#'@export
-#'
-#'@examples
-#' ## query meeting records by a period of the dates in Minguo (Taiwan) calendar
-#' ## 輸入「中華民國民年」下載「委員發言」
-#'get_meetings(start_date = "1050120", end_date = "1050210")
-#'
-#' ## query meeting records by a period of the dates in Minguo (Taiwan) calendar format
-#' ## and a meeting
-#' ## 輸入「中華民國民年」與「審查會議或委員會名稱」下載會議審查資訊
-#'get_meetings(start_date = 1060120, end_date = 1070310, meeting_unit = "內政委員會")
-#'
-#'@details `get_meetings` produces a list, which contains `title`, `query_time`,
-#'`retrieved_number`, `meeting_unit`, `start_date_ad`, `end_date_ad`, `start_date`,
-#'`end_date`, `url`, `variable_names`, `manual_info` and `data`.
-#'
-#'@note To retrieve the user manual and more information about variable of the data
-#'frame, please use `get_variable_info("get_meetings")` or visit
-#'the API manual at \url{https://www.ly.gov.tw/Pages/List.aspx?nodeid=154}.
-#'資料似乎不一致,待確認。委員發言(取得最早時間不詳,待檢查。)
-#'
-#'@seealso
-#'`get_variable_info("get_meetings")`
-#'
-#'@seealso
-#' Regarding Minguo calendar, please see \url{https://en.wikipedia.org/wiki/Republic_of_China_calendar}.
-
-get_meetings <- function(start_date = NULL, end_date = NULL, meeting_unit = NULL,
- verbose = TRUE) {
- check_internet()
- api_check(start_date = check_date(start_date), end_date = check_date(end_date))
- set_api_url <- paste("https://www.ly.gov.tw/WebAPI/LegislativeSpeech.aspx?from=",
- start_date, "&to=", end_date, "&meeting_unit=", meeting_unit, "&mode=json", sep = "")
- tryCatch(
- {
- with_options(list(timeout = max(1000, getOption("timeout"))),{json_df <- jsonlite::fromJSON(set_api_url)})
- df <- tibble::as_tibble(json_df)
- attempt::stop_if_all(nrow(df) == 0, isTRUE, msg = "The query is unavailable.")
- df["date_ad"] <- do.call("c", lapply(df$smeeting_date, transformed_date_meeting))
- if (isTRUE(verbose)) {
- cat(" Retrieved URL: \n", set_api_url, "\n")
- cat(" Retrieved via :", meeting_unit, "\n")
- cat(" Retrieved date between:", as.character(check_date(start_date)), "and", as.character(check_date(end_date)), "\n")
- cat(" Retrieved number:", nrow(df), "\n")
- }
- list_data <- list("title" = "the spoken meeting records",
- "query_time" = Sys.time(),
- "retrieved_number" = nrow(df),
- "meeting_unit" = meeting_unit,
- "start_date_ad" = check_date(start_date),
- "end_date_ad" = check_date(end_date),
- "start_date" = start_date,
- "end_date" = end_date,
- "url" = set_api_url,
- "variable_names" = colnames(df),
- "manual_info" = "https://www.ly.gov.tw/Pages/List.aspx?nodeid=154",
- "data" = df)
- return(list_data)
- },
- error = function(error_message) {
- message(error_message)
- }
- )
-}
-
-
-#'@title The Meeting Records of Cross-caucus Session 黨團協商資訊
-#'
-#'@author David Liao (davidycliao@@gmail.com)
-#'
-#'@param start_date character Must be formatted in Minguo (ROC) calendar with three
-#'forward slashes between year, month and day, e.g. "106/10/20".
-#'
-#'@param end_date character Must be formatted in Minguo (ROC) calendar with three
-#'forward slashes between year, month and day, e.g. "109/01/10".
-#'
-#'@param verbose logical, indicates whether `get_caucus_meetings` should print out
-#'detailed output when retrieving the data.
-#'
-#'@return list, which contains: \describe{
-#' \item{`title`}{the meeting records of cross-caucus session}
-#' \item{`query_time`}{the query time}
-#' \item{`retrieved_number`}{the number of observation}
-#' \item{`meeting_unit`}{the meeting unit}
-#' \item{`start_date_ad`}{the start date in POSIXct}
-#' \item{`end_date_ad`}{the end date in POSIXct}
-#' \item{`start_date`}{the start date in ROC Taiwan calendar}
-#' \item{`url`}{the retrieved json url}
-#' \item{`variable_names`}{the variables of the tibble dataframe}
-#' \item{`manual_info`}{the official manual, \url{https://data.ly.gov.tw/getds.action?id=8}; or use get_variable_info("get_caucus_meetings")}
-#' \item{`data`}{a tibble dataframe, whose variables include:
-#' \describe{\item{`comYear`}{卷}
-#' \item{`comVolume`}{期}
-#' \item{`comBookId`}{冊別}
-#' \item{`term`}{屆別}
-#' \item{`sessionPeriod`}{會期}
-#' \item{`meetingTimes`}{臨時會會次}
-#' \item{`meetingDate`}{會議日期(民國年)}
-#' \item{`meetingName`}{會議名稱}
-#' \item{`subject`}{案由}
-#' \item{`pageStart`}{起始頁}
-#' \item{`pageEnd`}{結束頁}
-#' \item{`docUrl`}{檔案下載位置}
-#' \item{`htmlUrl`}{html網址}
-#' \item{`selectTerm`}{屆別期別篩選條件}
-#' }
-#' }
-#' }
-#'
-#'@importFrom attempt stop_if_all
-#'@importFrom jsonlite fromJSON
-#'@importFrom withr with_options
-#'
-#'@export
-#'
-#'@examples
-#' ## query the meeting records of cross-caucus session using a period of
-#' ## the dates in Taiwan ROC calender format with forward slash (/).
-#' ## 輸入「中華民國民年」下載「黨團協商」,輸入時間請依照該格式 "106/10/20",
-#' ## 需有「正斜線」做隔開。
-#'get_caucus_meetings(start_date = "106/10/20", end_date = "107/03/10")
-#'
-#'@details `get_caucus_meetings` produces a list, which contains `title`, `query_time`,
-#'`retrieved_number`, `meeting_unit`, `start_date_ad`, `end_date_ad`, `start_date`,
-#'`end_date`, `url`, `variable_names`, `manual_info` and `data.`
-#'\\ifelse{html}{\\href{https://lifecycle.r-lib.org/articles/stages.html#experimental}{\\figure{lifecycle-experimental.svg}{options: alt='[Experimental]'}}}{\\strong{[Experimental]}}
-#'
-#'@note To retrieve the user manual and more information about variable of the data
-#' frame, please use `get_variable_info("get_caucus_meetings")`
-#' or visit the API manual at \url{https://data.ly.gov.tw/getds.action?id=8}.
-#' 議事類:提供公報之黨團協商資訊 (自第8屆第1會期起)
-#'
-#'@seealso
-#'`get_variable_info("get_caucus_meetings")`
-#'
-#'@seealso
-#' Regarding Minguo calendar, please see \url{https://en.wikipedia.org/wiki/Republic_of_China_calendar}.
-#
-# get_caucus_meetings <- function(start_date = NULL, end_date = NULL,
-# verbose = TRUE) {
-# check_internet()
-# api_check(start_date = transformed_date_meeting(start_date),
-# end_date = transformed_date_meeting(end_date))
-# set_api_url <- paste("https://data.ly.gov.tw/odw/ID8Action.action?comYear=&comVolume=&comBookId=&term=&sessionPeriod=&sessionTimes=&meetingTimes=&meetingDateS=",
-# start_date, "&meetingDateE=", end_date, "&fileType=json", sep = "")
-# tryCatch(
-# {
-# with_options(list(timeout = max(1000, getOption("timeout"))),{json_df <- jsonlite::fromJSON(set_api_url)})
-# df <- tibble::as_tibble(json_df$dataList)
-# attempt::stop_if_all(nrow(df) == 0, isTRUE, msg = "The query is unavailable.")
-# if (isTRUE(verbose)) {
-# cat(" Retrieved URL: \n", set_api_url, "\n")
-# cat(" Retrieved date between:", as.character(transformed_date_meeting(start_date)), "and", as.character(transformed_date_meeting(end_date)), "\n")
-# cat(" Retrieved number:", nrow(df), "\n")
-# }
-# list_data <- list("title" = "the meeting records of cross-caucus session",
-# "query_time" = Sys.time(),
-# "retrieved_number" = nrow(df),
-# "start_date_ad" = transformed_date_meeting(start_date),
-# "end_date_ad" = transformed_date_meeting(end_date),
-# "start_date" = start_date,
-# "end_date" = end_date,
-# "url" = set_api_url,
-# "variable_names" = colnames(df),
-# "manual_info" = "https://data.ly.gov.tw/getds.action?id=8",
-# "data" = df)
-# return(list_data)
-# },
-# error = function(error_message) {
-# message(error_message)
-# }
-# )
-# }
-get_caucus_meetings <- function(start_date = NULL, end_date = NULL,
- verbose = TRUE) {
- # 檢查日期格式
- date_format_check <- function(date) {
- if (!is.null(date) && !grepl("^\\d{3}/\\d{2}/\\d{2}$", date)) {
- stop(paste("Invalid date format:", date, "\n",
- "Please use the format 'YYY/MM/DD' (ROC calendar),\n",
- "For example: '106/10/20'\n",
- "Where YYY is the ROC year (民國年)"))
- }
- }
-
- check_internet()
-
- # 檢查開始和結束日期
- date_format_check(start_date)
- date_format_check(end_date)
-
- if(isTRUE(verbose)) {
- cat("Downloading caucus meetings data...\n")
- pb <- txtProgressBar(min = 0, max = 100, style = 3)
- }
-
- # Update progress bar to 20%
- if(isTRUE(verbose)) setTxtProgressBar(pb, 20)
-
- api_check(start_date = transformed_date_meeting(start_date),
- end_date = transformed_date_meeting(end_date))
-
- # Update progress bar to 40%
- if(isTRUE(verbose)) setTxtProgressBar(pb, 40)
-
- set_api_url <- paste("https://data.ly.gov.tw/odw/ID8Action.action?comYear=&comVolume=&comBookId=&term=&sessionPeriod=&sessionTimes=&meetingTimes=&meetingDateS=",
- start_date, "&meetingDateE=", end_date, "&fileType=json", sep = "")
-
- tryCatch(
- {
- # Update progress bar to 60%
- if(isTRUE(verbose)) setTxtProgressBar(pb, 60)
-
- with_options(list(timeout = max(1000, getOption("timeout"))),{
- json_df <- jsonlite::fromJSON(set_api_url)
- })
-
- # Update progress bar to 80%
- if(isTRUE(verbose)) setTxtProgressBar(pb, 80)
-
- df <- tibble::as_tibble(json_df$dataList)
- attempt::stop_if_all(nrow(df) == 0, isTRUE, msg = "The query is unavailable.")
-
- # Update progress bar to 100% and close it
- if(isTRUE(verbose)) {
- setTxtProgressBar(pb, 100)
- close(pb)
- cat("\n\n") # Add newlines after progress bar
- cat("====== Retrieved Information ======\n")
- cat("-----------------------------------\n")
- cat(" URL: \n", set_api_url, "\n")
- cat(" Date Range: ", as.character(transformed_date_meeting(start_date)),
- " to ", as.character(transformed_date_meeting(end_date)), "\n")
- cat(" Total Meetings: ", nrow(df), "\n")
- cat("===================================\n")
- }
-
- list_data <- list("title" = "the meeting records of cross-caucus session",
- "query_time" = Sys.time(),
- "retrieved_number" = nrow(df),
- "start_date_ad" = transformed_date_meeting(start_date),
- "end_date_ad" = transformed_date_meeting(end_date),
- "start_date" = start_date,
- "end_date" = end_date,
- "url" = set_api_url,
- "variable_names" = colnames(df),
- "manual_info" = "https://data.ly.gov.tw/getds.action?id=8",
- "data" = df)
- return(list_data)
- },
- error = function(error_message) {
- if(isTRUE(verbose)) {
- close(pb)
- cat("\n")
- }
- message(error_message)
- }
- )
-}
-
-#' @title The Video Information of Meetings and Committees 院會及委員會之委員發言片段相關影片資訊
-#'
-#' @param term numeric or NULL. Legislative term number (e.g., 10). Data is available from the 9th term onwards.
-#' @param session_period numeric or NULL. Session period (1-8).
-#' @param start_date character Must be formatted in Minguo (ROC) calendar with three
-#' forward slashes between year, month and day, e.g. "110/10/01".
-#' @param end_date character Must be formatted in Minguo (ROC) calendar with three
-#' forward slashes between year, month and day, e.g. "110/10/30".
-#' @param verbose logical, indicates whether get_speech_video should print out
-#' detailed output when retrieving the data. Default is TRUE.
-#'
-#' @return list, which contains:
-#' \describe{
-#' \item{`title`}{speech video records}
-#' \item{`query_time`}{query timestamp}
-#' \item{`retrieved_number`}{number of videos retrieved}
-#' \item{`term`}{queried legislative term}
-#' \item{`session_period`}{queried session period}
-#' \item{`start_date_ad`}{start date in POSIXct}
-#' \item{`end_date_ad`}{end date in POSIXct}
-#' \item{`start_date`}{start date in ROC calendar}
-#' \item{`end_date`}{end date in ROC calendar}
-#' \item{`url`}{retrieved API URL}
-#' \item{`variable_names`}{variables in the tibble dataframe}
-#' \item{`manual_info`}{official manual URL}
-#' \item{`data`}{a tibble dataframe containing:
-#' \describe{
-#' \item{`term`}{屆別}
-#' \item{`sessionPeriod`}{會期}
-#' \item{`meetingDate`}{會議日期(西元年)}
-#' \item{`meetingTime`}{會議時間}
-#' \item{`meetingTypeName`}{主辦單位}
-#' \item{`meetingName`}{會議名稱}
-#' \item{`meetingContent`}{會議事由}
-#' \item{`legislatorName`}{委員姓名}
-#' \item{`areaName`}{選區名稱}
-#' \item{`speechStartTime`}{委員發言時間起}
-#' \item{`speechEndTime`}{委員發言時間迄}
-#' \item{`speechRecordUrl`}{發言紀錄網址}
-#' \item{`videoLength`}{影片長度}
-#' \item{`videoUrl`}{影片網址}
-#' \item{`selectTerm`}{屆別期別篩選條件}
-#' }
-#' }
-#' }
-#'
-#' @importFrom attempt stop_if_all
-#' @importFrom jsonlite fromJSON
-#' @importFrom withr with_options
-#'
-#' @export
-#'
-#' @examples
-#' ## Query video information by term, session period and date range
-#' get_speech_video(
-#' term = 10,
-#' session_period = 4,
-#' start_date = "110/10/01",
-#' end_date = "110/10/30"
-#' )
-#'
-#' ## Query without specifying term or session
-#' get_speech_video(
-#' start_date = "110/10/01",
-#' end_date = "110/10/30"
-#' )
-#'
-#' @details The `get_speech_video` function retrieves video information of
-#' legislative meetings and committee sessions. Data is available from the
-#' 9th legislative term onwards (2016/民國105年). The date parameters must
-#' use the ROC calendar format with forward slashes.
-#'
-#' @note For more details about the data variables and API information,
-#' use `get_variable_info("get_speech_video")` or visit the API manual at
-#' \url{https://data.ly.gov.tw/getds.action?id=148}.
-#' 會議類:提供立法院院會及委員會之委員發言片段相關影片資訊 (自第9屆第1會期起)。
-#'
-#' @seealso
-#' `get_variable_info("get_speech_video")`
-
-# https://data.ly.gov.tw/odw/ID148Action.action?term=10&sessionPeriod=4&meetingDateS=110/10/01&meetingDateE=110/10/30&meetingTime=&legislatorName=&fileType=csv
-get_speech_video <- function(term = NULL,
- session_period = NULL,
- start_date = NULL,
- end_date = NULL,
- verbose = TRUE,
- format = "json") {
- # Check internet connectivity
- check_internet()
-
- # Format validation
- format <- match.arg(format, c("json", "csv"))
-
- if(isTRUE(verbose)) {
- cat("\nInput Format Information:\n")
- cat("------------------------\n")
- cat("Term: Must be numeric (e.g., 8, 9, 10)\n")
- cat("Session Period: Must be numeric (1-8)\n")
- cat("Date Format: YYY/MM/DD (ROC calendar)\n")
- cat("Example: 110/10/01\n")
- cat("------------------------\n\n")
- cat("Downloading speech video data...\n")
- pb <- txtProgressBar(min = 0, max = 100, style = 3)
- }
-
- # Date validation
- if(is.null(start_date) || is.null(end_date)) {
- stop("Both start_date and end_date must be provided")
- }
-
- # Input data validation
- if(!is.null(term)) {
- term_str <- sprintf("%02d", as.numeric(term))
- } else {
- term_str <- ""
- }
-
- if(!is.null(session_period)) {
- session_str <- sprintf("%02d", as.numeric(session_period))
- } else {
- session_str <- ""
- }
-
- # Update progress bar to 20%
- if(isTRUE(verbose)) setTxtProgressBar(pb, 20)
-
- # Construct API URL
- set_api_url <- paste0("https://data.ly.gov.tw/odw/ID148Action.action?",
- "term=", term_str,
- "&sessionPeriod=", session_str,
- "&meetingDateS=", start_date,
- "&meetingDateE=", end_date,
- "&meetingTime=&legislatorName=&fileType=", format)
-
- # Update progress bar to 40%
- if(isTRUE(verbose)) setTxtProgressBar(pb, 40)
-
- tryCatch(
- {
- # Update progress bar to 60%
- if(isTRUE(verbose)) setTxtProgressBar(pb, 60)
-
- if(format == "json") {
- response <- try({
- json_df <- jsonlite::fromJSON(set_api_url)
- if(!is.null(json_df$dataList)) {
- df <- tibble::as_tibble(json_df$dataList)
- } else {
- df <- tibble::tibble()
- }
- }, silent = TRUE)
- } else {
- response <- try({
- df <- readr::read_csv(set_api_url, show_col_types = FALSE)
- }, silent = TRUE)
- }
-
- # Update progress bar to 80%
- if(isTRUE(verbose)) setTxtProgressBar(pb, 80)
-
- # Data validation
- if(nrow(df) == 0) {
- if(isTRUE(verbose)) {
- setTxtProgressBar(pb, 100)
- close(pb)
- cat("\n\n")
- cat("====== Query Result ======\n")
- cat("-------------------------\n")
- cat("No records found. Please check:\n")
- cat("1. Date format (YYY/MM/DD)\n")
- cat("2. Term and session period\n")
- cat("3. Data availability\n")
- cat("-------------------------\n")
- }
- return(NULL)
- }
-
- # Update progress bar to 100%
- if(isTRUE(verbose)) {
- setTxtProgressBar(pb, 100)
- close(pb)
- cat("\n\n")
- cat("====== Retrieved Information ======\n")
- cat("-----------------------------------\n")
- cat(" Retrieved URL: \n", set_api_url, "\n")
- cat(" Term: ", term_str, "\n")
- if(!is.null(session_period)) {
- cat(" Session Period: ", session_period, "\n")
- }
- cat(" Date Range: ", start_date, " to ", end_date, "\n")
- cat(" Total Videos: ", nrow(df), "\n")
- cat(" Format: ", toupper(format), "\n")
- cat("===================================\n")
- }
-
- # Return data
- list_data <- list(
- "title" = "speech video records",
- "query_time" = Sys.time(),
- "retrieved_number" = nrow(df),
- "term" = term_str,
- "session_period" = session_str,
- "start_date" = start_date,
- "end_date" = end_date,
- "format" = format,
- "url" = set_api_url,
- "variable_names" = colnames(df),
- "manual_info" = "https://data.ly.gov.tw/getds.action?id=148",
- "data" = df
- )
- return(list_data)
- },
- error = function(error_message) {
- if(isTRUE(verbose)) {
- close(pb)
- cat("\nError occurred:\n")
- cat(as.character(error_message), "\n")
- }
- return(NULL)
- }
- )
-}
-
-
-#' The Records of National Public Debates 國是論壇
-#'
-#' @param term numeric or NULL. The default is set to 10. Legislative term number
-#' (e.g., 10). Data is officially available from the 8th term onwards, but
-#' testing shows data starts from the 10th term.
-#'
-#' @param session_period numeric or NULL. Session period number (1-8). Default is NULL.
-#' Use `review_session_info()` to see available session periods in ROC calendar.
-#'
-#' @param verbose logical. Whether to display download progress and detailed information.
-#' Default is TRUE.
-#'
-#' @return A list containing:
-#' \describe{
-#' \item{`title`}{public debates records}
-#' \item{`query_time`}{query timestamp}
-#' \item{`retrieved_number`}{number of records retrieved}
-#' \item{`retrieved_term`}{queried legislative term}
-#' \item{`url`}{retrieved API URL}
-#' \item{`variable_names`}{variables in the tibble dataframe}
-#' \item{`manual_info`}{official manual URL or use get_variable_info("get_public_debates")}
-#' \item{`data`}{a tibble dataframe containing:
-#' \describe{
-#' \item{`term`}{屆別}
-#' \item{`sessionPeriod`}{會期}
-#' \item{`sessionTimes`}{會次}
-#' \item{`meetingTimes`}{臨時會會次}
-#' \item{`dateTimeDesc`}{日期時間說明}
-#' \item{`meetingRoom`}{會議地點}
-#' \item{`chairman`}{主持人}
-#' \item{`legislatorName`}{委員姓名}
-#' \item{`speakType`}{發言類型(paper:書面發言,speak:發言)}
-#' \item{`content`}{內容}
-#' \item{`selectTerm`}{屆別期別篩選條件}
-#' }
-#' }
-#' }
-#'
-#' @importFrom attempt stop_if_all
-#' @importFrom jsonlite fromJSON
-#' @importFrom withr with_options
-#'
-#' @export
-#'
-#' @examples
-#' # Query public debates for term 10, session period 2
-#' debates <- get_public_debates(term = 10, session_period = 2)
-#'
-#' # Query without specifying session period
-#' debates <- get_public_debates(term = 10)
-#'
-#' @details
-#' The function retrieves records from the National Public Debates (國是論壇),
-#' including both spoken and written opinions. While officially available from
-#' the 8th legislative term, testing indicates data is only available from
-#' the 10th term onwards.
-#'
-#' @note
-#' For more details about the data variables and API information,
-#' use `get_variable_info("get_public_debates")` or visit the API manual at
-#' \url{https://data.ly.gov.tw/getds.action?id=7}.
-#' 議事類: 提供公報之國是論壇資訊,並包含書面意見。
-#' 自第8屆第1會期起,但實測資料從第10屆。
-#'
-#' @seealso
-#' * `get_variable_info("get_public_debates")`
-#' * `review_session_info()`
-#' * For ROC calendar information: \url{https://en.wikipedia.org/wiki/Republic_of_China_calendar}
-# get_public_debates <- function(term = NULL, session_period = NULL, verbose = TRUE) {
-# check_internet()
-# if (is.null(term)) {
-# set_api_url <- paste("https://data.ly.gov.tw/odw/ID7Action.action?term=",
-# term, "&sessionPeriod=",
-# "&sessionTimes=&meetingTimes=&legislatorName=&speakType=&fileType=json",
-# sep = "")
-# message(" term is not defined...\n You are now requesting full data from the API. Please make sure your connectivity is stable until its completion.\n")
-# } else {
-# attempt::stop_if_all(term, is.character, msg = "use numeric format only.")
-# if (length(term) == 1) {
-# term <- sprintf("%02d", as.numeric(term))}
-# else if (length(term) > 1) {
-# term <- paste(sprintf("%02d", as.numeric(term)), collapse = "&")
-# message("The API is unable to query multiple terms and the retrieved data might not be complete.")}
-# }
-# set_api_url <- paste("https://data.ly.gov.tw/odw/ID7Action.action?term=",
-# term, "&sessionPeriod=",
-# sprintf("%02d", as.numeric(session_period)),
-# "&sessionTimes=&meetingTimes=&legislatorName=&speakType=&fileType=json",
-# sep = "")
-# tryCatch(
-# {
-# with_options(list(timeout = max(1000, getOption("timeout"))),{json_df <- jsonlite::fromJSON(set_api_url)})
-# df <- tibble::as_tibble(json_df$dataList)
-# attempt::stop_if_all(nrow(df) == 0, isTRUE, msg = "The query is unavailable.")
-# if (isTRUE(verbose)) {
-# cat(" Retrieved URL: \n", set_api_url, "\n")
-# cat(" Retrieved Term: ", term, "\n")
-# cat(" Retrieved Num: ", nrow(df), "\n")
-# }
-# list_data <- list("title" = "the records of the questions answered by the executives",
-# "query_time" = Sys.time(),
-# "retrieved_number" = nrow(df),
-# "retrieved_term" = term,
-# "url" = set_api_url,
-# "variable_names" = colnames(df),
-# "manual_info" = "https://data.ly.gov.tw/getds.action?id=7",
-# "data" = df)
-# return(list_data)
-# },
-# error = function(error_message) {
-# message(error_message)
-# }
-# )
-# }
-
-get_public_debates <- function(term = NULL, session_period = NULL, verbose = TRUE) {
- check_internet()
-
- if(isTRUE(verbose)) {
- cat("\nInput Format Information:\n")
- cat("------------------------\n")
- cat("Term: Must be numeric (e.g., 8, 9, 10)\n")
- cat("Session Period: Must be numeric (1-8)\n")
- cat("------------------------\n\n")
- cat("Downloading public debates data...\n")
- pb <- txtProgressBar(min = 0, max = 100, style = 3)
- }
-
- # Update progress bar to 20%
- if(isTRUE(verbose)) setTxtProgressBar(pb, 20)
-
- if (is.null(term)) {
- set_api_url <- paste("https://data.ly.gov.tw/odw/ID7Action.action?term=",
- term, "&sessionPeriod=",
- "&sessionTimes=&meetingTimes=&legislatorName=&speakType=&fileType=json",
- sep = "")
- message(" term is not defined...\n You are now requesting full data from the API. Please make sure your connectivity is stable until its completion.\n")
- } else {
- attempt::stop_if_all(term, is.character, msg = "\nPlease use numeric format only.")
- if (length(term) == 1) {
- term <- sprintf("%02d", as.numeric(term))
- } else if (length(term) > 1) {
- if(isTRUE(verbose)) close(pb)
- term <- paste(sprintf("%02d", as.numeric(term)), collapse = "&")
- message("The API is unable to query multiple terms and the retrieved data might not be complete.")
- }
- }
-
- # Update progress bar to 40%
- if(isTRUE(verbose)) setTxtProgressBar(pb, 40)
-
- set_api_url <- paste("https://data.ly.gov.tw/odw/ID7Action.action?term=",
- term, "&sessionPeriod=",
- sprintf("%02d", as.numeric(session_period)),
- "&sessionTimes=&meetingTimes=&legislatorName=&speakType=&fileType=json",
- sep = "")
-
- tryCatch(
- {
- # Update progress bar to 60%
- if(isTRUE(verbose)) setTxtProgressBar(pb, 60)
-
- with_options(list(timeout = max(1000, getOption("timeout"))),{
- json_df <- jsonlite::fromJSON(set_api_url)
- })
-
- # Update progress bar to 80%
- if(isTRUE(verbose)) setTxtProgressBar(pb, 80)
-
- df <- tibble::as_tibble(json_df$dataList)
- attempt::stop_if_all(nrow(df) == 0, isTRUE, msg = "The query is unavailable.")
-
- # Update progress bar to 100%
- if(isTRUE(verbose)) {
- setTxtProgressBar(pb, 100)
- close(pb)
- cat("\n\n") # Add newlines after progress bar
- cat("====== Retrieved Information ======\n")
- cat("-----------------------------------\n")
- cat(" Retrieved URL: \n", set_api_url, "\n")
- cat(" Term: ", term, "\n")
- if(!is.null(session_period)) {
- cat(" Session Period: ", session_period, "\n")
- }
- cat(" Total Records: ", nrow(df), "\n")
- if("legislatorName" %in% colnames(df)) {
- unique_legislators <- length(unique(df$legislatorName))
- cat(" Unique Legislators: ", unique_legislators, "\n")
- }
- cat("===================================\n")
- }
-
- list_data <- list(
- "title" = "public debates records",
- "query_time" = Sys.time(),
- "retrieved_number" = nrow(df),
- "retrieved_term" = term,
- "url" = set_api_url,
- "variable_names" = colnames(df),
- "manual_info" = "https://data.ly.gov.tw/getds.action?id=7",
- "data" = df
- )
- return(list_data)
- },
- error = function(error_message) {
- if(isTRUE(verbose)) {
- close(pb)
- cat("\n")
- }
- message(error_message)
- }
- )
-}
-
-#' The Records of Reviewed Items in the Committees 委員會會議審查之議案項目
-#'
-#'@author David Yen-Chieh Liao
-#'
-#'@param term numeric or null. Data is available only from the 8th term.
-#'The default is set to 10. 參數必須為數值。提供委員會會議審查之議案項目。(自第10屆第1會期起)
-#'
-#'@param session_period integer, numeric or NULL.
-#'`review_session_info()` provides each session period's available options based on the
-#' Minguo (Taiwan) calendar.
-#'
-#'@param verbose logical. This indicates whether `get_executive_response` should
-#'print a detailed output during data retrieval. Default is TRUE.
-#'
-#'@return A list containing:
-#' \item{`title`}{Records of questions answered by executives}
-#' \item{`query_time`}{Time of query}
-#' \item{`retrieved_number`}{Total number of observations}
-#' \item{`retrieved_term`}{Queried term}
-#' \item{`url`}{Retrieved JSON URL}
-#' \item{`variable_names`}{Variables of the tibble dataframe}
-#' \item{`manual_info`}{Official manual, \url{https://data.ly.gov.tw/getds.action?id=46}; or use get_variable_info("get_committee_record")}
-#' \item{`data`}{A tibble dataframe with variables:
-#' \describe{
-#' \item{`term`}{Term number}
-#' \item{`sessionPeriod`}{Session}
-#' \item{`meetingNo`}{Meeting number}
-#' \item{`billNo`}{Bill number}
-#' \item{`selectTerm`}{Term selection filter}
-#' }
-#' }
-#'
-#'@importFrom attempt stop_if_all
-#'@importFrom jsonlite fromJSON
-#'@importFrom withr with_options
-#'
-#'@export
-#'
-#'@examples
-#' ## Query the committee record by term and session period.
-#' ## 輸入「立委屆期」與「會期」下載「委員會審議之議案」
-#'get_committee_record(term = 10, session_period = 1)
-#'
-#'@details `get_committee_record` provides a list which includes `title`,
-#'`query_time`, `retrieved_number`, `retrieved_term`, `url`, `variable_names`,
-#' `manual_info`, and `data`.
-#'
-#'@note
-#' To access the user manual and more information about the data frame's variables,
-#' please refer to `get_variable_info("get_committee_record")` or check the API manual at
-#' \url{https://data.ly.gov.tw/getds.action?id=46}.
-#' This provides agenda items reviewed in committee meetings (from the 10th term, 1st session onwards).
-#'
-#'@seealso
-#'`get_variable_info("get_committee_record")`, `review_session_info()`
-#' The Records of Reviewed Items in the Committees 委員會會議審查之議案項目
-#'
-#'@author David Yen-Chieh Liao
-#'
-#'@param term numeric or null. Data is available only from the 8th term.
-#'The default is set to 10. 參數必須為數值。提供委員會會議審查之議案項目。(自第10屆第1會期起)
-#'
-#'@param session_period integer, numeric or NULL.
-#'`review_session_info()` provides each session period's available options based on the
-#' Minguo (Taiwan) calendar.
-#'
-#'@param verbose logical. This indicates whether `get_executive_response` should
-#'print a detailed output during data retrieval. Default is TRUE.
-#'
-#'@return A list containing:
-#' \item{`title`}{Records of questions answered by executives}
-#' \item{`query_time`}{Time of query}
-#' \item{`retrieved_number`}{Total number of observations}
-#' \item{`retrieved_term`}{Queried term}
-#' \item{`url`}{Retrieved JSON URL}
-#' \item{`variable_names`}{Variables of the tibble dataframe}
-#' \item{`manual_info`}{Official manual, \url{https://data.ly.gov.tw/getds.action?id=46}; or use get_variable_info("get_committee_record")}
-#' \item{`data`}{A tibble dataframe with variables:
-#' \describe{
-#' \item{`term`}{Term number}
-#' \item{`sessionPeriod`}{Session}
-#' \item{`meetingNo`}{Meeting number}
-#' \item{`billNo`}{Bill number}
-#' \item{`selectTerm`}{Term selection filter}
-#' }
-#' }
-#'
-#'@importFrom attempt stop_if_all
-#'@importFrom jsonlite fromJSON
-#'@importFrom withr with_options
-#'
-#'@export
-#'
-#'@examples
-#' ## Query the committee record by term and session period.
-#' ## 輸入「立委屆期」與「會期」下載「委員會審議之議案」
-#'get_committee_record(term = 10, session_period = 1)
-#'
-#'@details `get_committee_record` provides a list which includes `title`,
-#'`query_time`, `retrieved_number`, `retrieved_term`, `url`, `variable_names`,
-#' `manual_info`, and `data`.
-#'
-#'@note
-#' To access the user manual and more information about the data frame's variables,
-#' please refer to `get_variable_info("get_committee_record")` or check the API manual at
-#' \url{https://data.ly.gov.tw/getds.action?id=46}.
-#' This provides agenda items reviewed in committee meetings (from the 10th term, 1st session onwards).
-#'
-#'@seealso
-#'`get_variable_info("get_committee_record")`, `review_session_info()`
-get_committee_record <- function(term = 10, session_period = NULL, verbose = TRUE) {
- check_internet()
-
- if(isTRUE(verbose)) {
- cat("\nInput Format Information:\n")
- cat("------------------------\n")
- cat("Term: Must be numeric (e.g., 8, 9, 10)\n")
- cat("Session Period: Must be numeric (1-8)\n")
- cat("------------------------\n\n")
- cat("Downloading committee records data...\n")
- pb <- txtProgressBar(min = 0, max = 100, style = 3)
- }
-
- # Update progress bar to 20%
- if(isTRUE(verbose)) setTxtProgressBar(pb, 20)
-
- if (is.null(term)) {
- set_api_url <- paste("https://data.ly.gov.tw/odw/ID46Action.action?term=",
- term, "&sessionPeriod=",
- "&sessionTimes=01&meetingTimes=&fileType=json", sep = "")
- message(" term is not defined...\n You are now requesting full data from the API. Please make sure your connectivity is stable until its completion.\n")
- } else {
- attempt::stop_if_all(term, is.character, msg = "use numeric format only.")
- if (length(term) == 1) {
- term <- sprintf("%02d", as.numeric(term))
- } else if (length(term) > 1) {
- if(isTRUE(verbose)) close(pb)
- term <- paste(sprintf("%02d", as.numeric(term)), collapse = "&")
- message("The API is unable to query multiple terms and the retrieved data might not be complete.")
- }
- }
-
- # Update progress bar to 40%
- if(isTRUE(verbose)) setTxtProgressBar(pb, 40)
-
- set_api_url <- paste("https://data.ly.gov.tw/odw/ID46Action.action?term=",
- term,
- "&sessionPeriod=", sprintf("%02d", as.numeric(session_period)),
- "&sessionTimes=01&meetingTimes=&fileType=json", sep = "")
-
- tryCatch(
- {
- # Update progress bar to 60%
- if(isTRUE(verbose)) setTxtProgressBar(pb, 60)
-
- with_options(list(timeout = max(1000, getOption("timeout"))),{
- json_df <- jsonlite::fromJSON(set_api_url)
- })
-
- # Update progress bar to 80%
- if(isTRUE(verbose)) setTxtProgressBar(pb, 80)
-
- df <- tibble::as_tibble(json_df$dataList)
- attempt::stop_if_all(nrow(df) == 0, isTRUE, msg = "The query is unavailable.")
-
- # Update progress bar to 100%
- if(isTRUE(verbose)) {
- setTxtProgressBar(pb, 100)
- close(pb)
- cat("\n\n") # Add newlines after progress bar
- cat("====== Retrieved Information ======\n")
- cat("-----------------------------------\n")
- cat(" Retrieved URL: \n", set_api_url, "\n")
- cat(" Term: ", term, "\n")
- if(!is.null(session_period)) {
- cat(" Session Period: ", session_period, "\n")
- }
- cat(" Total Records: ", nrow(df), "\n")
-
- if("committee" %in% colnames(df)) {
- committee_counts <- table(df$committee)
- cat("\nCommittee Distribution:\n")
- for(comm in names(committee_counts)) {
- cat(sprintf(" %s: %d\n", comm, committee_counts[comm]))
- }
- }
- cat("===================================\n")
- }
-
- list_data <- list(
- "title" = "the records of reviewed items in the committees",
- "query_time" = Sys.time(),
- "retrieved_number" = nrow(df),
- "retrieved_term" = term,
- "url" = set_api_url,
- "variable_names" = colnames(df),
- "manual_info" = "https://data.ly.gov.tw/getds.action?id=46",
- "data" = df
- )
- return(list_data)
- },
- error = function(error_message) {
- if(isTRUE(verbose)) {
- close(pb)
- cat("\n")
- }
- message(error_message)
- }
- )
-}
diff --git a/.Rproj.user/763C8F27/sources/session-ab45fd2f/2C96B37F-contents b/.Rproj.user/763C8F27/sources/session-ab45fd2f/2C96B37F-contents
deleted file mode 100644
index ab3b564d..00000000
--- a/.Rproj.user/763C8F27/sources/session-ab45fd2f/2C96B37F-contents
+++ /dev/null
@@ -1,62 +0,0 @@
----
-output: github_document
----
-
-
-
-```{r setup, include = FALSE}
-knitr::opts_chunk$set(
- collapse = TRUE,
- comment = "#>",
- fig.path = "man/figures/README-",
- out.width = "100%"
-)
-
-```
-
-
-# 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 eval=FALSE, include=TRUE}
-install.packages("remotes")
-remotes::install_github("davidycliao/legisTaiwan", force = TRUE)
-```
-
-```{r}
-library(legisTaiwan)
-```
-
-
----
-
-
-
-## 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/.Rproj.user/763C8F27/sources/session-ab45fd2f/30D52F8F-contents b/.Rproj.user/763C8F27/sources/session-ab45fd2f/30D52F8F-contents
deleted file mode 100644
index f22aab1b..00000000
--- a/.Rproj.user/763C8F27/sources/session-ab45fd2f/30D52F8F-contents
+++ /dev/null
@@ -1,55 +0,0 @@
-
-# `legisTaiwan` 0.1.7
-
-* Enhanced user experience by implementing progress bars for time-intensive operations. Progress bars are now displayed when verbose = TRUE.
-
-* Performed comprehensive spelling and typographical corrections throughout the package documentation and function names.
-
-
-
-------
-
-# `legisTaiwan` 0.1.6
-
-* Corrected spelling errors and standardized terminology across function documentation.
-
-# `legisTaiwan` 0.1.4 (development version)
-
-* re-documentation and inserting handlers.
-
-* formatting the website and documentation: `get_executive_response()`, `get_bills_2()`, `get_debates()` and `get_speech_video()`.
-
-* `get_bills()` and `get_meeting()`'s starting date are not clear.
-
-* `get_public_debates()` manual information is inconsistent with actual data.
-
-* ~~Two API endpoints,`質詢事項(本院委員質詢部分)` ~~and `國是論壇`, are~~ is temporarily down. Therefore, the data retrieved by `get_parlquestions()` ~~and `get_public_debates()`~~ may not be correct. [*UPDATE: Feb 5 2023*]~~
-
-* `get_public_debates()` is on. [*UPDATE: Feb 7 2023*]
-
-
-
-------
-
-# `legisTaiwan` 0.1.3 (development version)
-
-* Fix typo in function name: `get_variabel_infos()` to `get_variable_info()`.
-
-* `get_committee_record() ` is added to access to the records of reviewed items in the committees 提供委員會會議審查之議案項目.
-
-* Add funder and copyright holder in NAMESPACE: `國科會` and `立法院`
-
-* Re-documentation and inserting handlers
-
-
-
-------
-
-# `legisTaiwan` 0.1.1 (development version)
-
-* `get_executive_response()`, `get_bills_2()`, `get_debates()` and `get_speech_video()` are added.
-
-* The package is created with `get_meetings()`, `get_bills()`, `get_legislators()`, `get_parlquestions()`
-
-
-
diff --git a/.Rproj.user/763C8F27/sources/session-ab45fd2f/38649A2F-contents b/.Rproj.user/763C8F27/sources/session-ab45fd2f/38649A2F-contents
deleted file mode 100644
index 0f7aa065..00000000
--- a/.Rproj.user/763C8F27/sources/session-ab45fd2f/38649A2F-contents
+++ /dev/null
@@ -1,160 +0,0 @@
-#'@title The Legislator' Demographic Information and Background 提供委員基本資料
-#'
-#'@author David Liao (davidycliao@@gmail.com)
-#'
-#'@param term numeric or NULL The data is available from the 2nd term.
-#'
-#'@param verbose logical, indicates whether get_meetings should print out
-#'detailed output when retrieving the data. The default is set to TRUE.
-#'
-#'@return list contains: \describe{
-#' \item{`query_time`}{the queried time}
-#' \item{`queried_term`}{the queried term}
-#' \item{`url`}{the retrieved json url}
-#' \item{`variable_names`}{the variables of the tibble dataframe}
-#' \item{`manual_info`}{the official manual from \url{https://data.ly.gov.tw/getds.action?id=16}, or use legisTaiwan::get_variable_info("get_legislators")}
-#' \item{`data`}{a tibble dataframe, whose variables include:
-#' \describe{\item{`term`}{屆別}
-#' \item{`name`}{委員姓名}
-#' \item{`ename`}{委員姓名}
-#' \item{`sex`}{性別}
-#' \item{`party`}{黨籍}
-#' \item{`partyGroup`}{黨團}
-#' \item{`committee`}{委員會}
-#' \item{`onboardDate`}{到職日(西元年)}
-#' \item{`degree`}{學歷}
-#' \item{`experience`}{經歷}
-#' \item{`picPath`}{照片位址}
-#' \item{`leaveFlag`}{離職日期(西元年)}
-#' \item{`leaveReason`}{離職原因}
-#' }
-#' }
-#' }
-#'
-#'@importFrom attempt stop_if_all
-#'@importFrom jsonlite fromJSON
-#'@importFrom withr with_options
-#'
-#'@export
-#'
-#'@examples
-#' ## query the Executives' answered response by term and the session period.
-#' ## 輸入「立委屆期」與「會期」下載「行政院答復」
-#'get_executive_response(term = 8, session_period = 1)
-#'
-#'@details `get_legislators` produces a list, which contains `query_time`,
-#'`queried_term`, `url`, `variable_names`, `manual_info` and `data`.
-#'
-#'@note To retrieve the user manual and more information about variable of the data
-#' frame, please use `get_variable_info("get_legislators")`
-#' or visit the API manual at \url{https://data.ly.gov.tw/getds.action?id=16}.
-#' 提供委員基本資料,最早資料可追溯至第2屆。
-#'
-#'@seealso
-#'`get_variable_info("get_legislators")`, `review_session_info()`
-
-get_legislators <- function(term = NULL, verbose = TRUE) {
- check_internet()
-
- # 先檢查 term 並顯示訊息
- if (is.null(term)) {
- message("\nTerm is not defined...\nRequesting full data from the API. Please ensure stable connectivity.\n")
- }
-
- # 初始化進度顯示
- if(isTRUE(verbose)) {
- cat("\nInput Format Information:\n")
- cat("------------------------\n")
- cat("Term: Must be numeric (e.g., 8, 9, 10)\n")
- cat("------------------------\n\n")
- cat("Downloading legislators data...\n")
- pb <- txtProgressBar(min = 0, max = 100, style = 3)
- }
-
- # Update progress bar to 20%
- if(isTRUE(verbose)) setTxtProgressBar(pb, 20)
-
- # 建構 API URL
- if (is.null(term)) {
- set_api_url <- paste("https://data.ly.gov.tw/odw/ID16Action.action?name=&sex=&party=&partyGroup=&areaName=&term=",
- term, "=&fileType=json", sep = "")
- } else {
- attempt::stop_if_all(term, is.character, msg = "Please use numeric format only.")
- if (length(term) == 1) {
- term <- sprintf("%02d", as.numeric(term))
- } else if (length(term) > 1) {
- if(isTRUE(verbose)) close(pb)
- term <- paste(sprintf("%02d", as.numeric(term)), collapse = "&")
- message("API does not support multiple terms. Data might be incomplete.")
- }
-
- # Update progress bar to 40%
- if(isTRUE(verbose)) setTxtProgressBar(pb, 40)
- set_api_url <- paste("https://data.ly.gov.tw/odw/ID16Action.action?name=&sex=&party=&partyGroup=&areaName=&term=",
- term, "=&fileType=json", sep = "")
- }
-
- # 取得資料
- tryCatch(
- {
- # Update progress bar to 60%
- if(isTRUE(verbose)) setTxtProgressBar(pb, 60)
-
- with_options(list(timeout = max(1000, getOption("timeout"))),{
- json_df <- jsonlite::fromJSON(set_api_url)
- })
-
- # Update progress bar to 80%
- if(isTRUE(verbose)) setTxtProgressBar(pb, 80)
-
- df <- tibble::as_tibble(json_df$dataList)
- attempt::stop_if_all(nrow(df) == 0, isTRUE, msg = "Query returned no data.")
-
- # 計算統計資訊
- term <- paste(sort(as.numeric(unique(df$term))), collapse = " ", sep = ",")
- party_counts <- table(df$party)
-
- # Update progress bar to 100% and show results
- if(isTRUE(verbose)) {
- setTxtProgressBar(pb, 100)
- close(pb)
- cat("\n\n")
- cat("====== Retrieved Information ======\n")
- cat("-----------------------------------\n")
- cat(" URL: ", set_api_url, "\n")
- cat(" Term: ", term, "\n")
- cat(" Total Legislators: ", nrow(df), "\n")
- cat("-----------------------------------\n")
- cat("Party Distribution:\n")
- for(party in names(party_counts)) {
- if(!is.na(party) && party != "") {
- cat(sprintf(" %s: %d\n", party, party_counts[party]))
- }
- }
- cat("===================================\n")
- }
-
- # 回傳結果
- list_data <- list(
- "title" = "Legislator's Demographic Information",
- "query_time" = Sys.time(),
- "queried_term" = term,
- "url" = set_api_url,
- "total_legislators" = nrow(df),
- "party_distribution" = party_counts,
- "variable_names" = colnames(df),
- "manual_info" = "https://data.ly.gov.tw/getds.action?id=16",
- "data" = df
- )
- return(list_data)
- },
- error = function(error_message) {
- if(isTRUE(verbose)) {
- close(pb)
- cat("\nError occurred while fetching data:\n")
- cat(sprintf("Error: %s\n", error_message))
- }
- message(error_message)
- }
- )
-}
diff --git a/.Rproj.user/763C8F27/sources/session-ab45fd2f/3AA2D1AF-contents b/.Rproj.user/763C8F27/sources/session-ab45fd2f/3AA2D1AF-contents
deleted file mode 100644
index ab75c49f..00000000
--- a/.Rproj.user/763C8F27/sources/session-ab45fd2f/3AA2D1AF-contents
+++ /dev/null
@@ -1,249 +0,0 @@
-#' Clean legislator names
-#'
-#' @keywords internal
-.clean_names <- function(x) {
- names <- gsub("本院委員", "", x)
- names <- gsub("委員", "", names)
- names <- gsub("等\\s*\\d+\\s*人", "", names)
- names <- gsub("等\\d+人", "", names)
- names <- gsub("等", "", names)
- names <- gsub("\\s+", "", names)
- names <- gsub("本院", "", names)
- names <- trimws(names)
-
- return(names)
-}
-
-
-#' Validate Date Formats
-#'
-#' This function checks if the provided start and end dates are in the correct numeric format.
-#'
-#' @param start_date A string representing the start date. Expected format is numeric, e.g., "1090101".
-#' @param end_date A string representing the end date. Expected format is numeric, e.g., "1090101".
-#' @return NULL. If the dates are not in the expected format, an error is thrown.
-#' @examples
-#' # This should throw an error:
-#' \dontrun{
-#' validate_dates_format("10901", "1100101")
-#' }
-#' @keywords internal
-validate_dates_format <- function(start_date, end_date) {
- valid_date_format <- function(date) {
- return(grepl("^\\d{7}$", date))
- }
-
- if (!valid_date_format(start_date) || !valid_date_format(end_date)) {
- stop("Dates should be in numeric format. E.g., 1090101.")
- }
-}
-
-
-#' Check for the Website Availability I
-#'
-#' This function checks the availability of a specified website by trying to read
-#' the first line of the site's content.
-#'
-#' @param site A website URL to check. Default is "https://data.ly.gov.tw/index.action".
-#'
-#' @seealso
-#' `check_internet()`
-#'
-#' @keywords internal
-website_availability <- function(site = "https://data.ly.gov.tw/index.action") {
- tryCatch({
- readLines(site, n = 1)
- TRUE
- },
- warning = function(w) invokeRestart("muffleWarning"),
- error = function(e) FALSE)
-}
-
-#' Check for the Website Availability II
-#'
-#' This function checks the availability of a specified website by trying to read
-#' the first line of the site's content.
-#'
-#' @param site A website URL to check. Default is "https://npl.ly.gov.tw/do/www/appDate?status=0&expire=02&startYear=0".
-#'
-#' @keywords internal
-#' @seealso `check_internet()` and `website_availability()`.
-website_availability2 <- function(site = "https://npl.ly.gov.tw/do/www/appDate?status=0&expire=02&startYear=0") {
- tryCatch({
- readLines(site, n = 1)
- TRUE
- },
- warning = function(w) invokeRestart("muffleWarning"),
- error = function(e) FALSE)
-}
-
-
-
-#' A Check for Internet Connectivity.
-#'
-#'@param x The default value is `curl::has_internet()`, which activate the
-#'internet connectivity check.
-#'
-#'@importFrom attempt stop_if_not
-#'
-#'@importFrom curl has_internet
-#'
-#'@keywords internal
-check_internet <- function(x = curl::has_internet()) {
- attempt::stop_if_not(.x = x,
- msg = "Please check the internet connection")
-}
-
-#' A General Check for Taiwan Legislative Yuan API
-#'
-#'@param start_date start_date is inherited from global env.
-#'
-#'@param end_date end_date is inherited from global env.
-#'
-#'@importFrom attempt stop_if_not
-#'@keywords internal
-# api_check <- function(start_date = start_date, end_date = end_date) {
-# attempt::stop_if_all(start_date > as.Date(Sys.time()),
-# isTRUE, msg = "The start date should not be after the system time")
-# attempt::stop_if_all(end_date > as.Date(Sys.time()),
-# isTRUE, msg = "The end date should not be after the system time")
-# attempt::stop_if_all(start_date, is.character, msg = "use numeric format")
-# attempt::stop_if_all(end_date, is.character, msg = "use numeric format")
-# attempt::stop_if_all(start_date, is.null, msg = "start_date is missing")
-# attempt::stop_if_all(end_date, is.null, msg = "end_date is missing")
-# attempt::stop_if_all(end_date > start_date, isFALSE,
-# msg = paste("The start date, ", start_date, ",", " should not be later than the end date, ",
-# end_date, ".", sep = ""))
-# }
-api_check <- function(start_date = start_date, end_date = end_date) {
-
- attempt::stop_if_all(start_date > as.Date(Sys.time()),
- isTRUE, msg = "The start date should not be after the current system time.")
- attempt::stop_if_all(end_date > as.Date(Sys.time()),
- isTRUE, msg = "The end date should not be after the current system time.")
- attempt::stop_if_all(start_date, is.character,
- msg = "Use numeric format for start_date.")
- attempt::stop_if_all(end_date, is.character,
- msg = "Use numeric format for end_date.")
- attempt::stop_if_all(start_date, is.null,
- msg = "The parameter 'start_date' is missing.")
- attempt::stop_if_all(end_date, is.null,
- msg = "The parameter 'end_date' is missing.")
- attempt::stop_if_all(end_date > start_date, isFALSE,
- msg = paste("The start date, ", start_date, ",", " should not be later than the end date, ",
- end_date, ".", sep = ""))
-}
-
-
-#' Transforming Minguo (Taiwan) Calendar to A.D. Calendar I
-#'
-#' @description `transformed_date_meeting()` transforms Minguo (Taiwan) Calendar
-#' to A.D. calendar in POSIXct for `get_meetings()`, `get_caucus_meetings()`,
-#' and `get_speech_video()`,
-#'
-#' @param roc_date Date format in Minguo (Taiwan) calendar (e.g., "105/05/31") as a
-#' string vector
-#'
-#' @return date in POSIXct
-#'
-#' @importFrom stringr str_split_1
-#'
-#' @keywords internal
-#'
-#' @examples
-#' \dontrun{
-#' transformed_date_meeting("105/05/31")
-#' }
-#'
-#' @details `check_date` transforms ROC date to a date in POSIXct, e.g. "105/05/31" to "2016-05-31".
-transformed_date_meeting <- function(roc_date) {
- roc_date <- stringr::str_split_1(roc_date, "/")
- date_ad <- as.Date(as.POSIXct(paste(as.numeric(roc_date[1]) + 1911,
- roc_date[2],
- roc_date[3], sep = "-"),
- origin = "1582-10-14", tz = "GMT"))
- return(date_ad)
-}
-
-
-#' Transforming Minguo (Taiwan) Calendar to A.D. Calendar II
-#'
-#' @description `transformed_date_meeting()` transforms Minguo (Taiwan) Calendar
-#' to A.D. format in POSIXct for `get_bill()`, e.g. "1050531" to "2016-05-31".
-#'
-#' @param roc_date date format in Taiwan ROC calendar (e.g., "1050531") in a character vector
-#'
-#' @return date in POSIXct
-#'
-#' @importFrom stringr str_sub
-#'
-#' @keywords internal
-#'
-#' @examples
-#' \dontrun{
-#' transformed_date_bill("1050531")
-#' }
-transformed_date_bill <- function(roc_date) {
- day <- stringr::str_sub(roc_date, -2, -1)
- month <- stringr::str_sub(roc_date, -4, -3)
- roc_year <- stringr::str_sub(roc_date, 1, nchar(roc_date) - nchar(stringr::str_sub(roc_date, -4, -1)))
- date_ad <- as.Date(as.POSIXct(paste(as.numeric(roc_year) + 1911,
- as.numeric(month),
- as.numeric(day), sep = "-"),
- origin = "1582-10-14", tz = "GMT"))
- return(date_ad)
-}
-
-#' Transforming Minguo (Taiwan) Calendar to A.D. Calendar III
-#'
-#'@description `transformed_date_meeting()` transforms Minguo (Taiwan) Calendar
-#'to A.D. format in POSIXct for `get_bill()`, e.g. "1050531" to "2016-05-31".
-#'
-#'@param roc_date date format in Minguo (Taiwan) Calendar (e.g., "1050531") in a
-#'character vector
-#'
-#'@return date in POSIXct
-#'
-#'@importFrom stringr str_sub
-#'
-#'@keywords internal
-check_date <- function(roc_date) {
- day <- stringr::str_sub(roc_date, -2, -1)
- month <- stringr::str_sub(roc_date, -4, -3)
- roc_year <- stringr::str_sub(roc_date, 1, nchar(roc_date) - nchar(stringr::str_sub(roc_date, -4, -1)))
- date_ad <- as.Date(as.POSIXct(paste(as.numeric(roc_year) + 1911,
- as.numeric(month),
- as.numeric(day), sep = "-"),
- origin = "1582-10-14", tz = "GMT"))
- return(date_ad)
-}
-
-
-#' Transforming Minguo (Taiwan) Calendar to A.D. Calendar IIII
-#'
-#'@description `transformed_date_meeting()` transforms Minguo (Taiwan) Calendar
-#'to A.D. format in POSIXct for `get_bill()`, e.g. "1050531" to "2016-05-31".
-#'
-#'@param roc_date Date format in Minguo (Taiwan) calendar (e.g., "105/05/31") as a
-#'string vector
-#'
-#'@return date in POSIXct
-#'
-#'@importFrom stringr str_split_1
-#'
-#'@keywords internal
-#'
-#' @examples
-#' \dontrun{
-#' check_date2("105/05/31")
-#' }
-#'
-#'@details `check_date` transforms ROC date to a date in POSIXct, e.g. "105/05/31" to "2016-05-31".
-check_date2 <- function(roc_date) {
- roc_date <- stringr::str_split_1(roc_date, "/")
- date_ad <- as.Date(as.POSIXct(paste(as.numeric(roc_date[1]) + 1911,
- roc_date[2],
- roc_date[3], sep = "-"),
- origin = "1582-10-14", tz = "GMT"))
- return(date_ad)
-}
diff --git a/.Rproj.user/763C8F27/sources/session-ab45fd2f/3F148261-contents b/.Rproj.user/763C8F27/sources/session-ab45fd2f/3F148261-contents
deleted file mode 100644
index 55f54b29..00000000
--- a/.Rproj.user/763C8F27/sources/session-ab45fd2f/3F148261-contents
+++ /dev/null
@@ -1,42 +0,0 @@
-Package: legisTaiwan
-Type: Package
-Title: An Interface to Access Taiwan Legislative API in R
-Version: 0.1.7
-Authors@R: c(person("Yen-Chieh", "Liao", email = "davidycliao@gmail.com", role = c("aut", "cre")),
- person("Li", "Tang", email = "li.tang@reading.ac.uk", role = c("ctb", "aut")),
- person("Taiwan Legislative Yuan 立法院", role = c("cph", "fnd")),
- person("Taiwan National Science and Technology Council", role = "ctb"),
- person("Taiwan Science & Technology Policy Research and Information Center NARLabs", role = "ctb"))
-Description: The pacakge is designed to make it quickly and easy to access Taiwan
- Legislative Yuan API for downloading real-time data legislative and
- historical archives.
-Maintainer: Yen-Chieh Liao
-Depends: R (>= 3.4.0)
-License: GPL-3 + file LICENSE
-Encoding: UTF-8
-LazyData: true
-Imports:
- jsonlite,
- attempt,
- stringr,
- curl,
- tibble,
- rvest,
- withr,
- httr,
- utils
-Suggests:
- knitr,
- rmarkdown,
- ggplot2,
- remotes,
- tidyverse,
- testthat (>= 3.0.0)
-RoxygenNote: 7.3.2
-BugReports: https://github.com/davidycliao/legisTaiwan/issues
-URL: https://davidycliao.github.io/legisTaiwan/
-VignetteBuilder: knitr
-Roxygen: list(markdown = TRUE)
-Config/testthat/edition: 3
-Encoding: UTF-8
-SystemRequirements: pandoc (>= 1.14) - http://pandoc.org
diff --git a/.Rproj.user/763C8F27/sources/session-ab45fd2f/4105DDCB-contents b/.Rproj.user/763C8F27/sources/session-ab45fd2f/4105DDCB-contents
deleted file mode 100644
index 6c0d692c..00000000
--- a/.Rproj.user/763C8F27/sources/session-ab45fd2f/4105DDCB-contents
+++ /dev/null
@@ -1,46 +0,0 @@
-test_that("get_meetings", {
- expect_equal(get_meetings(start_date = 1050120, end_date = 1050210, verbose = FALSE)$data$smeeting_date, "105/02/01")
- expect_equal(nrow(get_meetings(start_date = 1040120, end_date = 1050310, verbose = TRUE)$data), 807)
- expect_error(get_meetings(start_date = 1040101, end_date = 1040102, verbose = FALSE), "Query returned no data.")
-})
-
-test_that("get_caucus_meetings", {
- expect_equal(get_caucus_meetings(start_date = "106/10/20", end_date = "107/03/10", verbose = FALSE)$retrieved_number, 27)
- expect_equal(get_caucus_meetings(start_date = "106/10/20", end_date = "107/03/10", verbose = FALSE)$retrieved_number,27)
-})
-
-# test_that("get_speech_video", {
-# expect_equal(get_speech_video(start_date = "105/10/20", end_date = "109/03/10")$retrieved_number, 547)
-# expect_equal(get_speech_video(start_date = "105/10/20", end_date = "109/03/10", verbose = FALSE)$retrieved_number, 547)
-# expect_error(get_speech_video(start_date = "104/01/01", end_date = "104/01/02", verbose = FALSE), "The query is unavailable.")
-#
-# })
-
-test_that("get_public_debates", {
- expect_equal(get_public_debates(term = 10, session_period = 1)$retrieved_number, 107)
- # expect_equal(get_public_debates(term = 10, session_period = 1, verbose = FALSE)$retrieved_number, 107)
- expect_error(get_public_debates(term = "10"), "use numeric format only.")
- # expect_error(get_public_debates(term = "10", verbose = TRUE), "use numeric format only.")
- # expect_equal(get_public_debates(term = NULL, verbose = TRUE)$title, "the records of the questions answered by the executives")
- # expect_message(get_public_debates(c(10,11)),
- # "The API is unable to query multiple terms and the retrieved data might not be complete.")
- # expect_error(get_public_debates(term = 30), "The query is unavailable.")
-
- })
-
-
-# test_that("get_committee_record", {
-# expect_equal(get_committee_record(term = 8, session_period= 1, verbose = FALSE)$retrieved_number, 613)
-# expect_equal(get_committee_record(term = 8, session_period= 2, verbose = FALSE)$retrieved_number, 633)
-# expect_equal(get_committee_record(term = 8, session_period= 2, verbose = TRUE)$title, "the records of reviewed items in the committees")
-# expect_error(get_committee_record(term = 2), "The query is unavailable.")
-# # expect_message(get_committee_record(c(10,11)),
-# # "The API is unable to query multiple terms and the retrieved data might not be complete.")
-# })
-
-# test_that("get_committee_record", {
-# expect_equal(get_committee_record(term = 10, session_period= 1, verbose = FALSE)$retrieved_number, 4844)
-# expect_equal(get_committee_record(term = 10, session_period= 2, verbose = TRUE)$title, "the records of reviewed items in the committees")
-# expect_error(get_committee_record(term = 2), "The query is unavailable.")
-# })
-
diff --git a/.Rproj.user/763C8F27/sources/session-ab45fd2f/45FC9AA6-contents b/.Rproj.user/763C8F27/sources/session-ab45fd2f/45FC9AA6-contents
deleted file mode 100644
index 2fee0978..00000000
--- a/.Rproj.user/763C8F27/sources/session-ab45fd2f/45FC9AA6-contents
+++ /dev/null
@@ -1,340 +0,0 @@
-#' The Records of Parliamentary Questions 委員質詢事項資訊
-#'
-#' @author David Liao (davidycliao@@gmail.com)
-#'
-#' @param term numeric or NULL. The default is set to NULL. 參數必須為數值。
-#'
-#' @param session_period integer, numeric or NULL. Available
-#' options for the session is: 1, 2, 3, 4, 5, 6, 7, and 8. The default is set to 8 參數必須為數值。
-#' `review_session_info()` generates each session period available option period
-#' in Minguo (Taiwan) calendar.
-#'
-#' @param verbose logical, indicates whether `get_parlquestions` should print out
-#' detailed output when retrieving the data. The default is TRUE.
-#'
-#' @return A list containing:
-#' \describe{
-#' \item{`title`}{the records of parliamentary questions}
-#' \item{`query_time`}{the queried time}
-#' \item{`retrieved_number`}{the total number of observations}
-#' \item{`retrieved_term`}{the queried term}
-#' \item{`url`}{the retrieved json url}
-#' \item{`variable_names`}{the variables of the tibble dataframe}
-#' \item{`manual_info`}{the offical manual from \url{https://data.ly.gov.tw/getds.action?id=6}, or use get_variable_info("get_parlquestions")}
-#' \item{`data`}{a tibble dataframe, whose variables include:
-#' \describe{
-#' \item{`term`}{屆別}
-#' \item{`sessionPeriod`}{會期}
-#' \item{`sessionTimes`}{會次}
-#' \item{`item`}{項目}
-#' \item{`selectTerm`}{屆別期別篩選條件}
-#' }
-#' }
-#' }
-#'
-#' @importFrom attempt stop_if_all
-#' @importFrom jsonlite fromJSON
-#' @importFrom withr with_options
-#' @export
-#'
-#' @examples
-#' ## Query parliamentary questions by term.
-#' ## 輸入「立委會期」下載立委質詢資料
-#' get_parlquestions(term = 10)
-#'
-#' ## Query parliamentary questions by term and session period.
-#' ## 輸入「立委屆期」與「會期」下載立委質詢資料
-#' get_parlquestions(term = 10, session_period = 2)
-#'
-#' @details `get_parlquestions` produces a list, which contains `title`,
-#' `query_time`, `retrieved_number`, `retrieved_term`, `url`, `variable_names`,
-#' `manual_info`, and `data`.
-#'
-#' @note To retrieve the user manual and more information about variable of the data
-#' frame, please use `get_variable_info("get_parlquestions")`
-#' or visit the API manual at \url{https://data.ly.gov.tw/getds.action?id=6}.
-#' 質詢類: 提供議事日程本院委員之質詢事項資訊(自第8屆第1會期起)。
-#'
-#' @seealso `get_variable_info("get_parlquestions")`
-get_parlquestions <- function(term = NULL, session_period = NULL, verbose = TRUE) {
- check_internet()
-
- # 先檢查 term 並顯示訊息
- if (is.null(term)) {
- message("\nTerm is not defined...\nRequesting full data from the API. Please ensure stable connectivity.\n")
- }
-
- # 初始化進度顯示
- if(isTRUE(verbose)) {
- cat("\nInput Format Information:\n")
- cat("------------------------\n")
- cat("Term: Must be numeric (e.g., 8, 9, 10)\n")
- cat("Session Period: Must be numeric (1-8)\n")
- cat("------------------------\n\n")
- cat("Downloading parliamentary questions data...\n")
- pb <- txtProgressBar(min = 0, max = 100, style = 3)
- }
-
- # Update progress bar to 20%
- if(isTRUE(verbose)) setTxtProgressBar(pb, 20)
-
- # 建構 API URL
- if (is.null(term)) {
- set_api_url <- paste("https://data.ly.gov.tw/odw/ID6Action.action?term=", term,
- "&sessionPeriod=",
- "&sessionTimes=&item=&fileType=json", sep = "")
- } else {
- attempt::stop_if_all(term, is.character, msg = "Please use numeric format only.")
- if (length(term) == 1) {
- term <- sprintf("%02d", as.numeric(term))
- } else if (length(term) > 1) {
- if(isTRUE(verbose)) close(pb)
- term <- paste(sprintf("%02d", as.numeric(term)), collapse = "&")
- stop("API does not support multiple terms.")
- }
- }
-
- # Update progress bar to 40%
- if(isTRUE(verbose)) setTxtProgressBar(pb, 40)
-
- set_api_url <- paste("https://data.ly.gov.tw/odw/ID6Action.action?term=", term,
- "&sessionPeriod=",
- sprintf("%02d", as.numeric(session_period)),
- "&sessionTimes=&item=&fileType=json", sep = "")
-
- tryCatch(
- {
- # Update progress bar to 60%
- if(isTRUE(verbose)) setTxtProgressBar(pb, 60)
-
- with_options(list(timeout = max(1000, getOption("timeout"))),{
- json_df <- jsonlite::fromJSON(set_api_url)
- })
-
- # Update progress bar to 80%
- if(isTRUE(verbose)) setTxtProgressBar(pb, 80)
-
- df <- tibble::as_tibble(json_df$dataList)
- attempt::stop_if_all(nrow(df) == 0, isTRUE, msg = "Query returned no data.")
-
- # Update progress bar to 100% and show results
- if(isTRUE(verbose)) {
- setTxtProgressBar(pb, 100)
- close(pb)
- cat("\n\n")
- cat("====== Retrieved Information ======\n")
- cat("-----------------------------------\n")
- cat(" URL: \n", set_api_url, "\n")
- cat(" Term: ", term, "\n")
- if(!is.null(session_period)) {
- cat(" Session Period: ", session_period, "\n")
- }
- cat(" Total Questions: ", nrow(df), "\n")
-
- # Add session period distribution if available
- if("sessionPeriod" %in% colnames(df)) {
- session_counts <- table(df$sessionPeriod)
- cat("\nSession Distribution:\n")
- for(session in names(session_counts)) {
- cat(sprintf(" Session %s: %d\n", session, session_counts[session]))
- }
- }
- cat("===================================\n")
- }
-
- # 回傳結果
- list_data <- list(
- "title" = "Parliamentary Questions Records",
- "query_time" = Sys.time(),
- "retrieved_number" = nrow(df),
- "retrieved_term" = term,
- "url" = set_api_url,
- "variable_names" = colnames(df),
- "manual_info" = "https://data.ly.gov.tw/getds.action?id=6",
- "data" = df
- )
- return(list_data)
- },
- error = function(error_message) {
- if(isTRUE(verbose)) {
- close(pb)
- cat("\nError occurred while fetching data:\n")
- cat(sprintf("Error: %s\n", error_message))
- }
- message(error_message)
- }
- )
-}
-
-#'The Records of Response to the Questions by the Executives 公報質詢事項行政院答復資訊
-#'
-#'@author David Liao (davidycliao@@gmail.com)
-#'
-#'@param term integer, numeric or NULL. The default is NULL. The data is only
-#'available from 8th term. 參數必須為數值。資料從自第8屆起,預設值為8。
-#'
-#'@param session_period integer, numeric or NULL. Available
-#'options for the session is: 1, 2, 3, 4, 5, 6, 7, and 8. The default is set to NULL. 參數必須為數值。
-#'`review_session_info()` generates each session period available option period
-#' in Minguo (Taiwan) calendar.
-#'
-#'@param verbose logical, indicates whether `get_executive_response` should
-#'print out detailed output when retrieving the data. The default is set to TRUE
-#'
-#'@return list contains: \describe{
-#' \item{`title`}{the records of the questions answered by the executives}
-#' \item{`query_time`}{the queried time}
-#' \item{`retrieved_number`}{the total number of observations}
-#' \item{`retrieved_term`}{the queried term}
-#' \item{`url`}{the retrieved json url}
-#' \item{`variable_names`}{the variables of the tibble dataframe}
-#' \item{`manual_info`}{the offical manual}
-#' \item{`data`}{a tibble dataframe, whose variables include:
-#' \describe{\item{`term`}{屆別}
-#' \item{`sessionPeriod`}{會期}
-#' \item{`sessionTimes`}{會次}
-#' \item{`meetingTimes`}{臨時會會次}
-#' \item{`eyNumber`}{行政院函公文編號}
-#' \item{`lyNumber`}{立法院函編號}
-#' \item{`subject`}{案由}
-#' \item{`content`}{內容}
-#' \item{`docUrl`}{案由}
-#' \item{`item`}{檔案下載位置}
-#' \item{`item`}{檔案下載位置}
-#' \item{`selectTerm`}{屆別期別篩選條件}
-#' }
-#' }
-#' }
-#'
-#'@importFrom attempt stop_if_all
-#'@importFrom jsonlite fromJSON
-#'@importFrom withr with_options
-#'@export
-#'
-#'@examples
-#' ## query the Executives' answered response by term and the session period.
-#' ## 輸入「立委屆期」與「會期」下載「行政院答復」
-#' get_executive_response(term = 8, session_period = 1)
-#'
-#'@details **`get_executive_response`** produces a list, which contains `title`,
-#'`query_time`, `retrieved_number`, `retrieved_term`, `url`, `variable_names`,
-#' `manual_info` and `data`. To retrieve the user manual and more information, please
-#' use `get_variable_info("get_executive_response")`.
-#'
-#'
-#'#'@note To retrieve the user manual and more information about variable of the data
-#' frame, please use `get_variable_info("get_executive_response")`
-#' or visit the API manual at \url{https://data.ly.gov.tw/getds.action?id=2}.
-#' 質詢類: 提供公報質詢事項行政院答復資訊 (自第8屆第1會期起)。
-#'
-#'@seealso
-#'`get_variable_info("get_executive_response")`, `review_session_info()`
-get_executive_response <- function(term = NULL, session_period = NULL, verbose = TRUE) {
- check_internet()
-
- # 先檢查 term 並顯示訊息
- if (is.null(term)) {
- message("\nTerm is not defined...\nRequesting full data from the API. Please ensure stable connectivity.\n")
- }
-
- # 初始化進度顯示
- if(isTRUE(verbose)) {
- cat("\nInput Format Information:\n")
- cat("------------------------\n")
- cat("Term: Must be numeric (e.g., 8, 9, 10, 11)\n")
- cat("Session Period: Must be numeric (1-8)\n")
- cat("------------------------\n\n")
- cat("Downloading executive response data...\n")
- pb <- txtProgressBar(min = 0, max = 100, style = 3)
- }
-
- # Update progress bar to 20%
- if(isTRUE(verbose)) setTxtProgressBar(pb, 20)
-
- # 建構 API URL
- if (is.null(term)) {
- set_api_url <- paste("https://data.ly.gov.tw/odw/ID2Action.action?term=",
- term, "&sessionPeriod=",
- "&sessionTimes=&item=&fileType=json", sep = "")
- } else {
- attempt::stop_if_all(term, is.character, msg = "\nPlease use numeric format only.")
- if (length(term) == 1) {
- term <- sprintf("%02d", as.numeric(term))
- } else if (length(term) > 1) {
- if(isTRUE(verbose)) close(pb)
- term <- paste(sprintf("%02d", as.numeric(term)), collapse = "&")
- stop("API does not support multiple terms.")
- }
- }
-
- # Update progress bar to 40%
- if(isTRUE(verbose)) setTxtProgressBar(pb, 40)
-
- set_api_url <- paste("https://data.ly.gov.tw/odw/ID2Action.action?term=",
- term, "&sessionPeriod=",
- sprintf("%02d", as.numeric(session_period)),
- "&sessionTimes=&item=&fileType=json", sep = "")
-
- tryCatch(
- {
- # Update progress bar to 60%
- if(isTRUE(verbose)) setTxtProgressBar(pb, 60)
-
- with_options(list(timeout = max(1000, getOption("timeout"))),{
- json_df <- jsonlite::fromJSON(set_api_url)
- })
-
- # Update progress bar to 80%
- if(isTRUE(verbose)) setTxtProgressBar(pb, 80)
-
- df <- tibble::as_tibble(json_df$dataList)
- attempt::stop_if_all(nrow(df) == 0, isTRUE, msg = "Query returned no data.")
-
- # Update progress bar to 100% and show results
- if(isTRUE(verbose)) {
- setTxtProgressBar(pb, 100)
- close(pb)
- cat("\n\n")
- cat("====== Retrieved Information ======\n")
- cat("-----------------------------------\n")
- cat(" URL: \n", set_api_url, "\n")
- cat(" Term: ", term, "\n")
- if(!is.null(session_period)) {
- cat(" Session Period: ", session_period, "\n")
- }
- cat(" Total Responses: ", nrow(df), "\n")
-
- # Add session period distribution if available
- if("sessionPeriod" %in% colnames(df)) {
- session_counts <- table(df$sessionPeriod)
- cat("\nSession Distribution:\n")
- for(session in names(session_counts)) {
- cat(sprintf(" Session %s: %d\n", session, session_counts[session]))
- }
- }
- cat("===================================\n")
- }
-
- # 回傳結果
- list_data <- list(
- "title" = "Executive Response Records",
- "query_time" = Sys.time(),
- "retrieved_number" = nrow(df),
- "retrieved_term" = term,
- "url" = set_api_url,
- "variable_names" = colnames(df),
- "manual_info" = "https://data.ly.gov.tw/getds.action?id=2",
- "data" = df
- )
- return(list_data)
- },
- error = function(error_message) {
- if(isTRUE(verbose)) {
- close(pb)
- cat("\nError occurred while fetching data:\n")
- cat(sprintf("Error: %s\n", error_message))
- }
- message(error_message)
- }
- )
-}
diff --git a/.Rproj.user/763C8F27/sources/session-ab45fd2f/5C2B3BCD-contents b/.Rproj.user/763C8F27/sources/session-ab45fd2f/5C2B3BCD-contents
deleted file mode 100644
index f0934fc0..00000000
--- a/.Rproj.user/763C8F27/sources/session-ab45fd2f/5C2B3BCD-contents
+++ /dev/null
@@ -1,7 +0,0 @@
-test_that("get_legislators", {
- expect_equal(nrow(get_legislators(term = 2)$data), 165)
- expect_equal(get_legislators(term = 2)$queried_term, "2")
- expect_equal(get_legislators(term = 2, verbose = FALSE)$queried_term, "2")
- expect_equal(get_legislators(term = 8)$queried_term, "8")
- expect_error(get_legislators(term = 30)$queried_term, "Query returned no data.")
- })
diff --git a/.Rproj.user/763C8F27/sources/session-ab45fd2f/5C7819EB-contents b/.Rproj.user/763C8F27/sources/session-ab45fd2f/5C7819EB-contents
deleted file mode 100644
index 8606071c..00000000
--- a/.Rproj.user/763C8F27/sources/session-ab45fd2f/5C7819EB-contents
+++ /dev/null
@@ -1,22 +0,0 @@
-test_that("get_parlquestions", {
- # expect_equal(get_parlquestions(term = 8, session_period = 1, verbose = FALSE)$title, "the records of parliarmentary questions")
- # expect_equal(get_parlquestions(term = 8, session_period = 1, verbose = TRUE)$retrieved_number, 957)
- expect_error(get_parlquestions(term = "9", verbose = FALSE), "Please use numeric format only.")
- expect_equal(get_parlquestions(NULL)$url, "https://data.ly.gov.tw/odw/ID6Action.action?term=&sessionPeriod=&sessionTimes=&item=&fileType=json")
- expect_error(get_parlquestions(c(8,9)))
- # expect_error(get_parlquestions(30), "Query returned no data.")
-})
-
-test_that("get_executive_response", {
- # checked 23 Jan 2023
- # checked 16 Sep 2023
- expect_equal(get_executive_response(term = 8, session_period = 1, verbose = FALSE)$retrieved_number,
- 1065)
- expect_equal(get_executive_response(term = 8, session_period = 1, verbose = TRUE)$retrieved_number,
- 1065)
- expect_error(get_executive_response(term = "9"), "Please use numeric format only.")
- # expect_error(get_executive_response(c(8,9)),
- # "The API is unable to query multiple terms.")
- # expect_error(get_executive_response(30), "Query returned no data.")
-
-})
diff --git a/.Rproj.user/763C8F27/sources/session-ab45fd2f/5FFCE106-contents b/.Rproj.user/763C8F27/sources/session-ab45fd2f/5FFCE106-contents
deleted file mode 100644
index a446bbd7..00000000
--- a/.Rproj.user/763C8F27/sources/session-ab45fd2f/5FFCE106-contents
+++ /dev/null
@@ -1,42 +0,0 @@
-#' On package attach, display a startup message
-#'
-#' @keywords internal
-.onAttach <- function(...) {
- # 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
- 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)
-
- # Second message
- message2 <- "## An R package connecting to the Taiwan Legislative API. ##"
-
- # Calculate the required number of spaces to align the two lines
- num_spaces <- nchar(message2, type = "bytes") - nchar(message1, type = "bytes") - 6 # -6 to account for the four hashes and two spaces
- num_spaces <- max(0, num_spaces)
-
- message1 <- paste0("## ", message1, rep(" ", num_spaces), " ##")
-
- packageStartupMessage(message1)
- packageStartupMessage(message2)
-}
-
diff --git a/.Rproj.user/763C8F27/sources/session-ab45fd2f/60827882-contents b/.Rproj.user/763C8F27/sources/session-ab45fd2f/60827882-contents
deleted file mode 100644
index 02960f13..00000000
--- a/.Rproj.user/763C8F27/sources/session-ab45fd2f/60827882-contents
+++ /dev/null
@@ -1,375 +0,0 @@
-#'The Records of the Bills: 法律提案
-#'
-#' @param start_date numeric. Must be formatted in the ROC Taiwan calendar, e.g., 1090101.
-#' @param end_date numeric. Must be formatted in the ROC Taiwan calendar, e.g., 1090102.
-#' @param proposer The default value is NULL, indicating that bills proposed by all legislators
-#' are included between the start and end dates.
-#' @param verbose logical. Specifies whether `get_bills` should print out
-#' detailed output when retrieving the data. The default value is TRUE.
-#'
-#' @return A list, which contains:
-#' \describe{
-#' \item{`title`}{Records of cross-caucus sessions}
-#' \item{`query_time`}{Query timestamp}
-#' \item{`retrieved_number`}{Number of observations retrieved}
-#' \item{`meeting_unit`}{Meeting unit}
-#' \item{`start_date_ad`}{Start date in POSIXct format}
-#' \item{`end_date_ad`}{End date in POSIXct format}
-#' \item{`start_date`}{Start date in the ROC Taiwan calendar}
-#' \item{`url`}{URL of the retrieved JSON data}
-#' \item{`variable_names`}{Variable names of the tibble dataframe}
-#' \item{`manual_info`}{Official manual. See \url{https://www.ly.gov.tw/Pages/List.aspx?nodeid=153} or use get_variable_info("get_bills")}
-#' \item{`data`}{A tibble dataframe with the following variables:
-#' \describe{\item{`term`}{Session number}
-#' \item{`sessionPeriod`}{Session period}
-#' \item{`sessionTimes`}{Session count}
-#' \item{`meetingTimes`}{Proposal date}
-#' \item{`billName`}{Bill name}
-#' \item{`billProposer`}{Primary proposer}
-#' \item{`billCosignatory`}{Co-signatories of the bill}
-#' \item{`billStatus`}{Status of the bill}
-#' \item{`date_ad`}{Date in the Gregorian calendar}
-#' }
-#' }
-#' }
-#'
-#' @import utils
-#' @importFrom httr GET
-#' @importFrom httr content
-#' @importFrom jsonlite fromJSON
-#' @importFrom tibble as_tibble
-#' @importFrom withr with_options
-#'
-#' @export
-#'
-#' @examples
-#' \dontrun{
-#' ## Query bill records by a date range in the Taiwan ROC calendar format
-#' get_bills(start_date = 1060120, end_date = 1070310, verbose = TRUE)
-#'
-#' ## Query bill records by a date range and a specific legislator
-#' get_bills(start_date = 1060120, end_date = 1070310, proposer = "孔文吉")
-#'
-#' ## Query bill records by a date range and multiple legislators
-#' get_bills(start_date = 1060120, end_date = 1060510, proposer = "孔文吉&鄭天財")
-#' }
-#'
-#' @details The `get_bills` function returns a list that contains `query_time`,
-#' `retrieved_number`, `meeting_unit`, `start_date_ad`, `end_date_ad`, `start_date`,
-#' `end_date`, `url`, `variable_names`, `manual_info`, and `data`.
-#'
-#' @note To retrieve the user manual and more details about the data frame, use `get_variable_info("get_bills")`.
-#' Further checks are required as the user manual seems to be inconsistent with the actual data.
-#'
-#' @seealso
-#' \url{https://www.ly.gov.tw/Pages/List.aspx?nodeid=153}
-get_bills <- function(start_date = NULL, end_date = NULL, proposer = NULL,
- verbose = TRUE) {
- check_internet()
- api_check(start_date = check_date(start_date), end_date = check_date(end_date))
- validate_dates_format(start_date, end_date)
- set_api_url <- paste("https://www.ly.gov.tw/WebAPI/LegislativeBill.aspx?from=",
- start_date, "&to=", end_date,
- "&proposer=", proposer, "&mode=json", sep = "")
-
- if(isTRUE(verbose)) {
- cat("\nInput Format Information:\n")
- cat("------------------------\n")
- cat("Date format: YYYMMDD (ROC calendar)\n")
- cat("Example: 1090101 for 2020/01/01\n")
- cat("------------------------\n\n")
- cat("Downloading data...\n")
- pb <- txtProgressBar(min = 0, max = 100, style = 3)
- }
-
- tryCatch(
- {
- # 更新進度條到 30%
- if(isTRUE(verbose)) setTxtProgressBar(pb, 30)
-
- with_options(list(timeout = max(1000, getOption("timeout"))),{
- json_df <- jsonlite::fromJSON(set_api_url)
- })
-
- # 更新進度條到 60%
- if(isTRUE(verbose)) setTxtProgressBar(pb, 60)
-
- df <- tibble::as_tibble(json_df)
- attempt::stop_if_all(nrow(df) == 0, isTRUE, msg = "The query is unavailable.")
- df["date_ad"] <- do.call("c", lapply(df$date, transformed_date_bill))
-
- # 更新進度條到 90%
- if(isTRUE(verbose)) setTxtProgressBar(pb, 90)
-
- if(isTRUE(verbose)) {
- setTxtProgressBar(pb, 100)
- close(pb)
- cat("\n\n") # Add newlines after progress bar
- cat("====== Retrieved Information ======\n")
- cat("-----------------------------------\n")
- cat(" Retrieved URL: \n", set_api_url, "\n")
- cat(" Total Unique Proposers:", length(unique(.clean_names(df$billProposer))), "\n")
- cat(" Retrieved date between:", as.character(check_date(start_date)),
- "and", as.character(check_date(end_date)), "\n")
- cat(" Retrieved Number: ", nrow(df), "\n")
-
- # Add bill statistics
- if(!is.null(df$billProposer)) {
- unique_proposers <- length(unique(.clean_names(df$billProposer)))
- cat(sprintf(" Total Unique Proposers: %d\n", unique_proposers))
- }
- cat("===================================\n")
- }
-
- list_data <- list("title" = "the records of bill sponsor and co-sponsor",
- "query_time" = Sys.time(),
- "retrieved_number" = nrow(df),
- "proposer" = proposer,
- "start_date_ad" = check_date(start_date),
- "end_date_ad" = check_date(end_date),
- "start_date" = start_date,
- "end_date" = end_date,
- "url" = set_api_url,
- "variable_names" = colnames(df),
- "manual_info" = "https://www.ly.gov.tw/Pages/List.aspx?nodeid=153",
- "data" = df)
- return(list_data)
- },
- error = function(error_message) {
- if(isTRUE(verbose)) {
- close(pb)
- cat("\n")
- }
- message(error_message)
- }
- )
-}
-
-
-#' The Records of Legislation and the Executives Proposals: 委員及政府議案提案資訊
-#' @title The Records of Legislation and the Executives Proposals: 委員及政府議案提案資訊
-#'
-#' @author David Liao (davidycliao@@gmail.com)
-#'
-#' @param term A numeric or NULL value. Data is available from the 8th term onwards.
-#' Default is set to 8. 參數必須為數值。資料從第8屆開始,預設值為8。
-#'
-#' @param session_period An integer, numeric, or NULL. Valid options for the session are:
-#' 1, 2, 3, 4, 5, 6, 7, and 8. Default is set to NULL.
-#' 參數必須為數值。
-#' `review_session_info()` provides available session periods based on the Minguo (Taiwan) calendar.
-#'
-#' @param verbose Default value is TRUE. Displays details of the retrieved data, including the number, URL, and computing time.
-#'
-#' @return A list containing:
-#' \item{`title`}{Records of questions answered by the executives}
-#' \item{`query_time`}{Query time}
-#' \item{`retrieved_number`}{Number of observations}
-#' \item{`retrieved_term`}{Retrieved term}
-#' \item{`url`}{Retrieved JSON URL}
-#' \item{`variable_names`}{Variables of the tibble dataframe}
-#' \item{`manual_info`}{Official manual: \url{https://data.ly.gov.tw/getds.action?id=20} or use `get_variable_info("get_bills_2")`}
-#' \item{`data`}{A tibble dataframe with variables such as:
-#' \describe{
-#' \item{`term`}{屆別}
-#' \item{`sessionPeriod`}{會期}
-#' \item{`sessionTimes`}{會次}
-#' \item{`meetingTimes`}{臨時會會次}
-#' \item{`billNo`}{議案編號}
-#' \item{`billName`}{提案名稱}
-#' \item{`billOrg`}{提案單位/委員}
-#' \item{`billProposer`}{主提案人}
-#' \item{`billCosignatory`}{連署提案}
-#' \item{`billStatus`}{議案狀態}
-#' \item{`pdfUrl`}{PDF download link for related documents}
-#' \item{`docUrl`}{DOC download link for related documents}
-#' \item{`selectTerm`}{Filtering criteria based on term}
-#' }
-#' }
-#'
-#' @import utils
-#' @importFrom attempt stop_if_all
-#' @importFrom jsonlite fromJSON
-#' @importFrom httr GET
-#' @importFrom tibble as_tibble
-#' @importFrom withr with_options
-#'
-#' @export
-#'
-#' @examples
-#' \dontrun{
-#' ## Query the executives' responses by term and session period.
-#' ## 輸入「立委屆期」與「會期」以下載「質詢事項 (行政院答復部分)」
-#' get_bills_2(term = 8, session_period = 1)
-#' }
-#'
-#' @details The `get_bills_2` function produces a list, which includes `query_time`,
-#' `retrieved_number`, `retrieved_term`, `url`, `variable_names`, `manual_info`, and `data`.
-#' For the user manual and more information about the dataframe, use `get_variable_info("get_bills_2")`.
-#'
-#' @note For more details about the dataframe's variables, use `get_variable_info("get_bills_2")`
-#' or visit the API manual at \url{https://data.ly.gov.tw/getds.action?id=20}.
-#' 議事類: 提供委員及政府之議案提案資訊 (從第8屆第1會期開始)。
-#'
-#' @seealso
-#' `get_variable_info("get_bills_2")`,`review_session_info()`
-#'
-#' @encoding UTF-8
-get_bills_2 <- function(term = 8, session_period = NULL, verbose = TRUE) {
- # Check for internet connectivity
- check_internet()
-
- # Format info at the start
- if(isTRUE(verbose)) {
- cat("\nInput Format Information:\n")
- cat("------------------------\n")
- cat("Term: Must be numeric (e.g., 8, 9, 10, 11)\n")
- cat("Session Period: Must be numeric (1-8)\n")
- cat("------------------------\n\n")
- cat("Downloading legislative bills data...\n")
- pb <- txtProgressBar(min = 0, max = 100, style = 3)
- }
-
- # If the term is not specified
- if (is.null(term)) {
- # Set the base API URL without specifying any term
- set_api_url <- "https://data.ly.gov.tw/odw/ID20Action.action?term=&sessionPeriod=&sessionTimes=&meetingTimes=&billName=&billOrg=&billProposer=&billCosignatory=&fileType=json"
- # Display a notification message
- message("The term is not defined...\nYou are now requesting full data from the API. Please ensure a stable internet connection until completion.\n")
- } else {
- # Update progress bar to 20%
- if(isTRUE(verbose)) setTxtProgressBar(pb, 20)
- # If the term is in character format, stop execution and display an error message
- attempt::stop_if_all(term, is.character, msg = "\nPlease use numeric format only.")
- # If term length is one, format the term to two digits
- if (length(term) == 1) {
- term <- sprintf("%02d", as.numeric(term))
- } else if (length(term) > 1) {
- if(isTRUE(verbose)) close(pb)
- stop("The API doesn't support querying multiple terms. Consider implementing batch processing. Please refer to the tutorial for guidance.")
- }
- # Convert session period to two-digit format, if it's not NULL
- session_str <- ifelse(is.null(session_period), "", sprintf("%02d", as.numeric(session_period)))
- # Construct the complete API URL
- set_api_url <- paste0("https://data.ly.gov.tw/odw/ID20Action.action?term=",
- term, "&sessionPeriod=", session_str,
- "&sessionTimes=&meetingTimes=&billName=&billOrg=&billProposer=&billCosignatory=&fileType=json")
- }
-
- # Update progress bar to 40%
- if(isTRUE(verbose)) setTxtProgressBar(pb, 40)
-
- # Try to fetch the data and process it
- tryCatch(
- {
- with_options(list(timeout = max(1000, getOption("timeout"))),{
- json_df <- jsonlite::fromJSON(set_api_url)
- })
-
- # Update progress bar to 60%
- if(isTRUE(verbose)) setTxtProgressBar(pb, 60)
-
- df <- tibble::as_tibble(json_df$dataList)
-
- # Update progress bar to 80%
- if(isTRUE(verbose)) setTxtProgressBar(pb, 80)
-
- # If the returned data is empty, stop execution and display an error message
- attempt::stop_if_all(nrow(df) == 0, isTRUE, msg = "The query is unavailable.")
-
- # Calculate summary statistics
- total_bills <- nrow(df)
- budget_bills <- if("billName" %in% colnames(df)) sum(grepl("預算", df$billName)) else 0
- budget_percentage <- if(total_bills > 0) (budget_bills / total_bills) * 100 else 0
-
- # Update progress bar to 100%
- if(isTRUE(verbose)) {
- setTxtProgressBar(pb, 100)
- close(pb)
- cat("\n\n") # Add newlines after progress bar
- cat("====== Retrieved Information ======\n")
- cat("-----------------------------------\n")
- cat(" Retrieved URL: \n", set_api_url, "\n")
- if(!is.null(session_period)) {
- cat(" Retrieved Session Period: ", session_period, "\n")
- }
- cat(" Retrieved Term: ", term, "\n")
-
- # Calculate total bills and unique legislators
- total_bills <- nrow(df)
- unique_legislators <- length(unique(.clean_names(df$billOrg)))
-
- cat(sprintf(" Total Bills: %d\n", total_bills))
- cat(sprintf(" Total Unique Proposers: %d\n", unique_legislators))
- cat("===================================\n")
- # if(isTRUE(verbose)) {
- # setTxtProgressBar(pb, 100)
- # close(pb)
- # cat("\n\n") # Add newlines after progress bar
- # cat("====== Retrieved Information ======\n")
- # cat("-----------------------------------\n")
- # cat(" URL: \n", set_api_url, "\n")
- # cat(" Term: ", term, "\n")
- # if(!is.null(session_period)) {
- # cat(" Session Period: ", session_period, "\n")
- # }
- #
- # # Overall Statistics
- # cat("\nOverall Statistics:\n")
- # cat("-----------------------------------\n")
- # cat(sprintf(" Total Bills: %d\n", total_bills))
- # cat(sprintf(" Budget Bills: %d (%.1f%%)\n", budget_bills, budget_percentage))
- #
- # # Detailed Bill Type Distribution
- # if("billName" %in% colnames(df)) {
- # bill_types <- table(df$billName)
- # cat("\nBill Type Distribution:\n")
- # cat("-----------------------------------\n")
- # for(type in names(bill_types)) {
- # count <- bill_types[type]
- # percentage <- (count / total_bills) * 100
- # cat(sprintf(" %s: %d (%.1f%%)\n", type, count, percentage))
- # }
- # }
- #
- # # Proposer Distribution
- # if("billOrg" %in% colnames(df)) {
- # cat("\nProposer Distribution:\n")
- # cat("-----------------------------------\n")
- # proposer_counts <- table(.clean_legislator_names(df$billOrg))
- # for(proposer in names(proposer_counts)) {
- # count <- proposer_counts[proposer]
- # percentage <- (count / total_bills) * 100
- # if(nchar(trimws(proposer)) > 0) { # Only show non-empty proposers
- # cat(sprintf(" %s: %d (%.1f%%)\n", proposer, count, percentage))
- # }
- # }
- # }
- # cat("===================================\n")
-
- }
-
- # Construct the result list
- list_data <- list(
- "title" = "The records of the questions answered by the executives",
- "query_time" = Sys.time(),
- "retrieved_number" = total_bills,
- "budget_bills" = budget_bills,
- "budget_percentage" = budget_percentage,
- "retrieved_term" = term,
- "url" = set_api_url,
- "variable_names" = colnames(df),
- "manual_info" = "https://data.ly.gov.tw/getds.action?id=2",
- "data" = df
- )
- return(list_data)
- },
- error = function(error_message) {
- if(isTRUE(verbose)) {
- close(pb)
- cat("\n")
- }
- message(error_message)
- }
- )
-}
diff --git a/.Rproj.user/763C8F27/sources/session-ab45fd2f/6178CD1E b/.Rproj.user/763C8F27/sources/session-ab45fd2f/6178CD1E
deleted file mode 100644
index 154f58e2..00000000
--- a/.Rproj.user/763C8F27/sources/session-ab45fd2f/6178CD1E
+++ /dev/null
@@ -1,26 +0,0 @@
-{
- "id": "6178CD1E",
- "path": "~/Dropbox/My Packages/legisTaiwan/_pkgdown.yml",
- "project_path": "_pkgdown.yml",
- "type": "yaml",
- "hash": "0",
- "contents": "",
- "dirty": false,
- "created": 1735335828408.0,
- "source_on_save": false,
- "relative_order": 6,
- "properties": {
- "source_window_id": "",
- "Source": "Source",
- "cursorPosition": "102,43",
- "scrollLine": "96"
- },
- "folds": "",
- "lastKnownWriteTime": 1735335850,
- "encoding": "UTF-8",
- "collab_server": "",
- "source_window": "",
- "last_content_update": 1735335850012,
- "read_only": false,
- "read_only_alternatives": []
-}
\ No newline at end of file
diff --git a/.Rproj.user/763C8F27/sources/session-ab45fd2f/6178CD1E-contents b/.Rproj.user/763C8F27/sources/session-ab45fd2f/6178CD1E-contents
deleted file mode 100644
index 0405c080..00000000
--- a/.Rproj.user/763C8F27/sources/session-ab45fd2f/6178CD1E-contents
+++ /dev/null
@@ -1,119 +0,0 @@
-url: https://davidycliao.github.io/legisTaiwan/
-
-home:
- title: Accessing Real-time and Archives of Taiwan Legislative Data in R
-
- links:
- - text: Discussion
- href: https://github.com/davidycliao/legisTaiwan/discussions
- - text: legisCrawler 爬台灣立法委員問政專輯的爬蟲小幫手️🕸️
- href: https://davidycliao.github.io/legisCrawler/
- - text: "The Centre for Artificial Intelligence in Government (CAIG)"
- href: https://www.birmingham.ac.uk/research/centres-institutes/centre-for-artificial-intelligence-in-government
- - text: "ParlSpeech: Legislative Speeches in the Key Parliamentary Democracies"
- href: https://dataverse.harvard.edu/dataset.xhtml?persistentId=doi:10.7910/DVN/L4OAKN
- - 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
- desc: functions connect to Taiwan Legialtive Yuan API.
-- contents:
- - get_parlquestions
- - get_meetings
- - get_caucus_meetings
- - get_executive_response
- - get_public_debates
- - get_speech_video
- - get_committee_record
- - get_bills
- - get_bills_2
- - get_legislators
- - get_variable_info
- - review_session_info
-
-authors:
- Yen-Chieh Liao:
- href: https://davidycliao.github.io
- Li Tang:
- href: https://sites.google.com/view/litang2020?pli=1
- Taiwan Legislative Yuan 立法院:
- href: "https://data.ly.gov.tw/catelog.action"
- html: ""
-
-
-template:
- package: tidytemplate
- bootstrap: 5
- includes:
- in_header: |
-
- params:
- ganalytics: G-X85ED8P5EW
-
-development:
- mode: auto
-
-navbar:
- type: inverse
- left:
- - icon: fa-home
- href: index.html
- - icon: fa-rocket
- text: Quick Start
- menu:
- - text: "Quick Start Guide"
- href: articles/quickstart.html#get-started-with-using-remotes
- - text: "How to Contribute"
- href: articles/quickstart.html#quickstart.html#how-to-contribute
-
-
- - icon: fa-project-diagram
- text: Manual
- menu:
- - text: "Interpellation and Debates"
- href: articles/manual.html#interpellation-and-debates
- - text: "Bill and Budget"
- href: articles/manual.html#bill-and-budget
- - text: "Miscellaneous"
- href: articles/manual.html#miscellaneous
-
- - icon: fa-file-code-o
- text: Reference
- menu:
- - 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:
- - text: "0.1.7"
- href: news/index.html#legistaiwan-017-development-version
- - text: "0.1.6"
- href: news/index.html#legistaiwan-016-development-version
- - text: "0.1.4"
- href: news/index.html#legistaiwan-014-development-version
- - text: "0.1.3"
- href: news/index.html#legistaiwan-013-development-version
- - text: "0.1.1"
- href: news/index.html#legistaiwan-011-development-version
-
- right:
- - icon: fa-github fa-lg
- text: GitHub
- href: https://github.com/davidycliao/legisTaiwan
-
-
-
diff --git a/.Rproj.user/763C8F27/sources/session-ab45fd2f/61EA4764-contents b/.Rproj.user/763C8F27/sources/session-ab45fd2f/61EA4764-contents
deleted file mode 100644
index 7bd7978d..00000000
--- a/.Rproj.user/763C8F27/sources/session-ab45fd2f/61EA4764-contents
+++ /dev/null
@@ -1,249 +0,0 @@
-#' Clean legislator Names
-#' @encoding UTF-8
-#' @keywords internal
-.clean_names <- function(x) {
- names <- gsub("本院委員", "", x)
- names <- gsub("委員", "", names)
- names <- gsub("等\\s*\\d+\\s*人", "", names)
- names <- gsub("等\\d+人", "", names)
- names <- gsub("等", "", names)
- names <- gsub("\\s+", "", names)
- names <- gsub("本院", "", names)
- names <- trimws(names)
-
- return(names)
-}
-
-
-#' Validate Date Formats
-#'
-#' This function checks if the provided start and end dates are in the correct numeric format.
-#'
-#' @param start_date A string representing the start date. Expected format is numeric, e.g., "1090101".
-#' @param end_date A string representing the end date. Expected format is numeric, e.g., "1090101".
-#' @return NULL. If the dates are not in the expected format, an error is thrown.
-#' @examples
-#' # This should throw an error:
-#' \dontrun{
-#' validate_dates_format("10901", "1100101")
-#' }
-#' @keywords internal
-validate_dates_format <- function(start_date, end_date) {
- valid_date_format <- function(date) {
- return(grepl("^\\d{7}$", date))
- }
-
- if (!valid_date_format(start_date) || !valid_date_format(end_date)) {
- stop("Dates should be in numeric format. E.g., 1090101.")
- }
-}
-
-
-#' Check for the Website Availability I
-#'
-#' This function checks the availability of a specified website by trying to read
-#' the first line of the site's content.
-#'
-#' @param site A website URL to check. Default is "https://data.ly.gov.tw/index.action".
-#'
-#' @seealso
-#' `check_internet()`
-#'
-#' @keywords internal
-website_availability <- function(site = "https://data.ly.gov.tw/index.action") {
- tryCatch({
- readLines(site, n = 1)
- TRUE
- },
- warning = function(w) invokeRestart("muffleWarning"),
- error = function(e) FALSE)
-}
-
-#' Check for the Website Availability II
-#'
-#' This function checks the availability of a specified website by trying to read
-#' the first line of the site's content.
-#'
-#' @param site A website URL to check. Default is "https://npl.ly.gov.tw/do/www/appDate?status=0&expire=02&startYear=0".
-#'
-#' @keywords internal
-#' @seealso `check_internet()` and `website_availability()`.
-website_availability2 <- function(site = "https://npl.ly.gov.tw/do/www/appDate?status=0&expire=02&startYear=0") {
- tryCatch({
- readLines(site, n = 1)
- TRUE
- },
- warning = function(w) invokeRestart("muffleWarning"),
- error = function(e) FALSE)
-}
-
-
-
-#' A Check for Internet Connectivity.
-#'
-#'@param x The default value is `curl::has_internet()`, which activate the
-#'internet connectivity check.
-#'
-#'@importFrom attempt stop_if_not
-#'
-#'@importFrom curl has_internet
-#'
-#'@keywords internal
-check_internet <- function(x = curl::has_internet()) {
- attempt::stop_if_not(.x = x,
- msg = "Please check the internet connection")
-}
-
-#' A General Check for Taiwan Legislative Yuan API
-#'
-#'@param start_date start_date is inherited from global env.
-#'
-#'@param end_date end_date is inherited from global env.
-#'
-#'@importFrom attempt stop_if_not
-#'@keywords internal
-# api_check <- function(start_date = start_date, end_date = end_date) {
-# attempt::stop_if_all(start_date > as.Date(Sys.time()),
-# isTRUE, msg = "The start date should not be after the system time")
-# attempt::stop_if_all(end_date > as.Date(Sys.time()),
-# isTRUE, msg = "The end date should not be after the system time")
-# attempt::stop_if_all(start_date, is.character, msg = "use numeric format")
-# attempt::stop_if_all(end_date, is.character, msg = "use numeric format")
-# attempt::stop_if_all(start_date, is.null, msg = "start_date is missing")
-# attempt::stop_if_all(end_date, is.null, msg = "end_date is missing")
-# attempt::stop_if_all(end_date > start_date, isFALSE,
-# msg = paste("The start date, ", start_date, ",", " should not be later than the end date, ",
-# end_date, ".", sep = ""))
-# }
-api_check <- function(start_date = start_date, end_date = end_date) {
-
- attempt::stop_if_all(start_date > as.Date(Sys.time()),
- isTRUE, msg = "The start date should not be after the current system time.")
- attempt::stop_if_all(end_date > as.Date(Sys.time()),
- isTRUE, msg = "The end date should not be after the current system time.")
- attempt::stop_if_all(start_date, is.character,
- msg = "Use numeric format for start_date.")
- attempt::stop_if_all(end_date, is.character,
- msg = "Use numeric format for end_date.")
- attempt::stop_if_all(start_date, is.null,
- msg = "The parameter 'start_date' is missing.")
- attempt::stop_if_all(end_date, is.null,
- msg = "The parameter 'end_date' is missing.")
- attempt::stop_if_all(end_date > start_date, isFALSE,
- msg = paste("The start date, ", start_date, ",", " should not be later than the end date, ",
- end_date, ".", sep = ""))
-}
-
-
-#' Transforming Minguo (Taiwan) Calendar to A.D. Calendar I
-#'
-#' @description `transformed_date_meeting()` transforms Minguo (Taiwan) Calendar
-#' to A.D. calendar in POSIXct for `get_meetings()`, `get_caucus_meetings()`,
-#' and `get_speech_video()`,
-#'
-#' @param roc_date Date format in Minguo (Taiwan) calendar (e.g., "105/05/31") as a
-#' string vector
-#'
-#' @return date in POSIXct
-#'
-#' @importFrom stringr str_split_1
-#'
-#' @keywords internal
-#'
-#' @examples
-#' \dontrun{
-#' transformed_date_meeting("105/05/31")
-#' }
-#'
-#' @details `check_date` transforms ROC date to a date in POSIXct, e.g. "105/05/31" to "2016-05-31".
-transformed_date_meeting <- function(roc_date) {
- roc_date <- stringr::str_split_1(roc_date, "/")
- date_ad <- as.Date(as.POSIXct(paste(as.numeric(roc_date[1]) + 1911,
- roc_date[2],
- roc_date[3], sep = "-"),
- origin = "1582-10-14", tz = "GMT"))
- return(date_ad)
-}
-
-
-#' Transforming Minguo (Taiwan) Calendar to A.D. Calendar II
-#'
-#' @description `transformed_date_meeting()` transforms Minguo (Taiwan) Calendar
-#' to A.D. format in POSIXct for `get_bill()`, e.g. "1050531" to "2016-05-31".
-#'
-#' @param roc_date date format in Taiwan ROC calendar (e.g., "1050531") in a character vector
-#'
-#' @return date in POSIXct
-#'
-#' @importFrom stringr str_sub
-#'
-#' @keywords internal
-#'
-#' @examples
-#' \dontrun{
-#' transformed_date_bill("1050531")
-#' }
-transformed_date_bill <- function(roc_date) {
- day <- stringr::str_sub(roc_date, -2, -1)
- month <- stringr::str_sub(roc_date, -4, -3)
- roc_year <- stringr::str_sub(roc_date, 1, nchar(roc_date) - nchar(stringr::str_sub(roc_date, -4, -1)))
- date_ad <- as.Date(as.POSIXct(paste(as.numeric(roc_year) + 1911,
- as.numeric(month),
- as.numeric(day), sep = "-"),
- origin = "1582-10-14", tz = "GMT"))
- return(date_ad)
-}
-
-#' Transforming Minguo (Taiwan) Calendar to A.D. Calendar III
-#'
-#'@description `transformed_date_meeting()` transforms Minguo (Taiwan) Calendar
-#'to A.D. format in POSIXct for `get_bill()`, e.g. "1050531" to "2016-05-31".
-#'
-#'@param roc_date date format in Minguo (Taiwan) Calendar (e.g., "1050531") in a
-#'character vector
-#'
-#'@return date in POSIXct
-#'
-#'@importFrom stringr str_sub
-#'
-#'@keywords internal
-check_date <- function(roc_date) {
- day <- stringr::str_sub(roc_date, -2, -1)
- month <- stringr::str_sub(roc_date, -4, -3)
- roc_year <- stringr::str_sub(roc_date, 1, nchar(roc_date) - nchar(stringr::str_sub(roc_date, -4, -1)))
- date_ad <- as.Date(as.POSIXct(paste(as.numeric(roc_year) + 1911,
- as.numeric(month),
- as.numeric(day), sep = "-"),
- origin = "1582-10-14", tz = "GMT"))
- return(date_ad)
-}
-
-
-#' Transforming Minguo (Taiwan) Calendar to A.D. Calendar IIII
-#'
-#'@description `transformed_date_meeting()` transforms Minguo (Taiwan) Calendar
-#'to A.D. format in POSIXct for `get_bill()`, e.g. "1050531" to "2016-05-31".
-#'
-#'@param roc_date Date format in Minguo (Taiwan) calendar (e.g., "105/05/31") as a
-#'string vector
-#'
-#'@return date in POSIXct
-#'
-#'@importFrom stringr str_split_1
-#'
-#'@keywords internal
-#'
-#' @examples
-#' \dontrun{
-#' check_date2("105/05/31")
-#' }
-#'
-#'@details `check_date` transforms ROC date to a date in POSIXct, e.g. "105/05/31" to "2016-05-31".
-check_date2 <- function(roc_date) {
- roc_date <- stringr::str_split_1(roc_date, "/")
- date_ad <- as.Date(as.POSIXct(paste(as.numeric(roc_date[1]) + 1911,
- roc_date[2],
- roc_date[3], sep = "-"),
- origin = "1582-10-14", tz = "GMT"))
- return(date_ad)
-}
diff --git a/.Rproj.user/763C8F27/sources/session-ab45fd2f/6AD4F8AF-contents b/.Rproj.user/763C8F27/sources/session-ab45fd2f/6AD4F8AF-contents
deleted file mode 100644
index e5100848..00000000
--- a/.Rproj.user/763C8F27/sources/session-ab45fd2f/6AD4F8AF-contents
+++ /dev/null
@@ -1,51 +0,0 @@
-test_that("get_meetings", {
- expect_equal(get_meetings(start_date = 1050120, end_date = 1050210, verbose = FALSE)$data$smeeting_date, "105/02/01")
- expect_equal(nrow(get_meetings(start_date = 1040120, end_date = 1050310, verbose = TRUE)$data), 807)
- expect_error(get_meetings(start_date = 1040101, end_date = 1040102, verbose = FALSE), "The query is unavailable.")
-
-})
-
-test_that("get_caucus_meetings", {
- expect_equal(get_caucus_meetings(start_date = "106/10/20", end_date = "107/03/10", verbose = FALSE)$retrieved_number, 27)
- expect_equal(get_caucus_meetings(start_date = "106/10/20", end_date = "107/03/10", verbose = FALSE)$retrieved_number,27)
-})
-
-# test_that("get_speech_video", {
-# expect_equal(get_speech_video(start_date = "105/10/20", end_date = "109/03/10")$retrieved_number, 547)
-# expect_equal(get_speech_video(start_date = "105/10/20", end_date = "109/03/10", verbose = FALSE)$retrieved_number, 547)
-# expect_error(get_speech_video(start_date = "104/01/01", end_date = "104/01/02", verbose = FALSE), "The query is unavailable.")
-#
-# })
-
-
-
-
-test_that("get_public_debates", {
- expect_equal(get_public_debates(term = 10, session_period = 1)$retrieved_number, 107)
- # expect_equal(get_public_debates(term = 10, session_period = 1, verbose = FALSE)$retrieved_number, 107)
- expect_error(get_public_debates(term = "10"), "use numeric format only.")
- # expect_error(get_public_debates(term = "10", verbose = TRUE), "use numeric format only.")
- # expect_equal(get_public_debates(term = NULL, verbose = TRUE)$title, "the records of the questions answered by the executives")
- # expect_message(get_public_debates(c(10,11)),
- # "The API is unable to query multiple terms and the retrieved data might not be complete.")
- # expect_error(get_public_debates(term = 30), "The query is unavailable.")
-
- })
-
-
-
-# test_that("get_committee_record", {
-# expect_equal(get_committee_record(term = 8, session_period= 1, verbose = FALSE)$retrieved_number, 613)
-# expect_equal(get_committee_record(term = 8, session_period= 2, verbose = FALSE)$retrieved_number, 633)
-# expect_equal(get_committee_record(term = 8, session_period= 2, verbose = TRUE)$title, "the records of reviewed items in the committees")
-# expect_error(get_committee_record(term = 2), "The query is unavailable.")
-# # expect_message(get_committee_record(c(10,11)),
-# # "The API is unable to query multiple terms and the retrieved data might not be complete.")
-# })
-
-# test_that("get_committee_record", {
-# expect_equal(get_committee_record(term = 10, session_period= 1, verbose = FALSE)$retrieved_number, 4844)
-# expect_equal(get_committee_record(term = 10, session_period= 2, verbose = TRUE)$title, "the records of reviewed items in the committees")
-# expect_error(get_committee_record(term = 2), "The query is unavailable.")
-# })
-
diff --git a/.Rproj.user/763C8F27/sources/session-ab45fd2f/70F2581F-contents b/.Rproj.user/763C8F27/sources/session-ab45fd2f/70F2581F-contents
deleted file mode 100644
index 9f5330eb..00000000
--- a/.Rproj.user/763C8F27/sources/session-ab45fd2f/70F2581F-contents
+++ /dev/null
@@ -1,120 +0,0 @@
-url: https://davidycliao.github.io/legisTaiwan/
-
-home:
- title: Accessing Real-time and Archives of Taiwan Legislative Data in R
-
- links:
- - text: Discussion
- href: https://github.com/davidycliao/legisTaiwan/discussions
- - 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: "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: "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
- desc: functions connect to Taiwan Legialtive Yuan API.
-- contents:
- - get_parlquestions
- - get_meetings
- - get_caucus_meetings
- - get_executive_response
- - get_public_debates
- - get_speech_video
- - get_committee_record
- - get_bills
- - get_bills_2
- - get_legislators
- - get_variable_info
- - review_session_info
-
-authors:
- David Liao:
- href: https://davidycliao.github.io
- Li Tang:
- href: https://sites.google.com/view/litang2020?pli=1
- Taiwan Legislative Yuan 立法院:
- href: "https://data.ly.gov.tw/catelog.action"
- html: ""
-
-
-template:
- package: tidytemplate
- bootstrap: 5
- includes:
- in_header: |
-
- params:
- ganalytics: G-X85ED8P5EW
-
-development:
- mode: auto
-
-navbar:
- type: inverse
- left:
- - icon: fa-home
- href: index.html
- - icon: fa-rocket
- text: Quick Start
- menu:
- - text: "Quick Start Guide"
- href: articles/quickstart.html#get-started-with-using-remotes
- - text: "How to Contribute"
- href: articles/quickstart.html#quickstart.html#how-to-contribute
-
- - icon: fa-project-diagram
- text: Manual
- menu:
- - text: "Interpellation and Debates"
- href: articles/manual.html#interpellation-and-debates
- - text: "Bill and Budget"
- href: articles/manual.html#bill-and-budget
- - text: "Miscellaneous"
- href: articles/manual.html#miscellaneous
-
- - icon: fa-file-code-o
- text: Reference
- menu:
- - 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/get_caucus_meetings.html
-
- - icon: fa-newspaper-o
- text: News
- menu:
- - text: "0.1.6"
- href: news/index.html#legistaiwan-016-development-version
- - text: "0.1.4"
- href: news/index.html#legistaiwan-014-development-version
- - text: "0.1.3"
- href: news/index.html#legistaiwan-013-development-version
- - text: "0.1.1"
- href: news/index.html#legistaiwan-011-development-version
-
- right:
- - icon: fa-github fa-lg
- text: GitHub
- href: https://github.com/davidycliao/legisTaiwan
-
-
-
diff --git a/.Rproj.user/763C8F27/sources/session-ab45fd2f/7B380B8B-contents b/.Rproj.user/763C8F27/sources/session-ab45fd2f/7B380B8B-contents
deleted file mode 100644
index f8a68f2b..00000000
--- a/.Rproj.user/763C8F27/sources/session-ab45fd2f/7B380B8B-contents
+++ /dev/null
@@ -1,1003 +0,0 @@
-#' The Spoken Meeting Records 委員發言
-#'
-#'@author David Liao (davidycliao@@gmail.com)
-#'
-#'@param start_date numeric Must be formatted in Minguo (Taiwan) calendar, e.g. 1090101.
-#'
-#'@param end_date numeric Must be formatted in Minguo (Taiwan) calendar, e.g. 1090102.
-#'
-#'@param meeting_unit NULL The default is NULL, which includes all meeting types
-#' between the starting date and the ending date.
-#'
-#'@param verbose logical, indicates whether `get_meetings` should print out
-#'detailed output when retrieving the data.
-#'
-#'@return list, which contains: \describe{
-#' \item{`title`}{the spoken meeting records }
-#' \item{`query_time`}{the query time}
-#' \item{`retrieved_number`}{the number of the observation}
-#' \item{`meeting_unit`}{the meeting unit}
-#' \item{`start_date_ad`}{the start date in POSIXct}
-#' \item{`end_date_ad`}{the end date in POSIXct}
-#' \item{`start_date`}{the start date in ROC Taiwan calendar}
-#' \item{`url`}{the retrieved json url}
-#' \item{`variable_names`}{the variables of the tibble dataframe}
-#' \item{`manual_info`}{the offical manual, \url{https://www.ly.gov.tw/Pages/List.aspx?nodeid=154}; or use get_variable_info("get_meetings")}
-#' \item{`data`}{a tibble dataframe, whose variables include:
-#' \describe{\item{`smeeting_date`}{會議日期}
-#' \item{`meeting_status`}{會議狀態}
-#' \item{`meeting_name`}{會議名稱}
-#' \item{`meeting_content`}{會議事由}
-#' \item{`speechers`}{委員發言名單}
-#' \item{`meeting_unit`}{主辦單位}
-#' \item{`date_ad`}{西元年}
-#' }
-#' }
-#' }
-#'
-#'@import utils
-#'@importFrom attempt stop_if_all
-#'@importFrom jsonlite fromJSON
-#'@importFrom withr with_options
-#'
-#'@export
-#'
-#'@examples
-#' ## query meeting records by a period of the dates in Minguo (Taiwan) calendar
-#' ## 輸入「中華民國民年」下載「委員發言」
-#'get_meetings(start_date = "1050120", end_date = "1050210")
-#'
-#' ## query meeting records by a period of the dates in Minguo (Taiwan) calendar format
-#' ## and a meeting
-#' ## 輸入「中華民國民年」與「審查會議或委員會名稱」下載會議審查資訊
-#' get_meetings(start_date = 1060120, end_date = 1070310, meeting_unit = "內政委員會")
-#'
-#'@details `get_meetings` produces a list, which contains `title`, `query_time`,
-#'`retrieved_number`, `meeting_unit`, `start_date_ad`, `end_date_ad`, `start_date`,
-#'`end_date`, `url`, `variable_names`, `manual_info` and `data`.
-#'
-#'@note To retrieve the user manual and more information about variable of the data
-#'frame, please use `get_variable_info("get_meetings")` or visit
-#'the API manual at \url{https://www.ly.gov.tw/Pages/List.aspx?nodeid=154}.
-#'資料似乎不一致,待確認。委員發言(取得最早時間不詳,待檢查。)
-#'
-#'@seealso
-#'`get_variable_info("get_meetings")`
-#'
-#'@seealso
-#' Regarding Minguo calendar, please see \url{https://en.wikipedia.org/wiki/Republic_of_China_calendar}.
-#'
-#'@encoding UTF-8
-
-# get_meetings <- function(start_date = NULL, end_date = NULL, meeting_unit = NULL,
-# verbose = TRUE) {
-# check_internet()
-# api_check(start_date = check_date(start_date), end_date = check_date(end_date))
-# set_api_url <- paste("https://www.ly.gov.tw/WebAPI/LegislativeSpeech.aspx?from=",
-# start_date, "&to=", end_date, "&meeting_unit=", meeting_unit, "&mode=json", sep = "")
-# tryCatch(
-# {
-# with_options(list(timeout = max(1000, getOption("timeout"))),{json_df <- jsonlite::fromJSON(set_api_url)})
-# df <- tibble::as_tibble(json_df)
-# attempt::stop_if_all(nrow(df) == 0, isTRUE, msg = "The query is unavailable.")
-# df["date_ad"] <- do.call("c", lapply(df$smeeting_date, transformed_date_meeting))
-# if (isTRUE(verbose)) {
-# cat(" Retrieved URL: \n", set_api_url, "\n")
-# cat(" Retrieved via :", meeting_unit, "\n")
-# cat(" Retrieved date between:", as.character(check_date(start_date)), "and", as.character(check_date(end_date)), "\n")
-# cat(" Retrieved number:", nrow(df), "\n")
-# }
-# list_data <- list("title" = "the spoken meeting records",
-# "query_time" = Sys.time(),
-# "retrieved_number" = nrow(df),
-# "meeting_unit" = meeting_unit,
-# "start_date_ad" = check_date(start_date),
-# "end_date_ad" = check_date(end_date),
-# "start_date" = start_date,
-# "end_date" = end_date,
-# "url" = set_api_url,
-# "variable_names" = colnames(df),
-# "manual_info" = "https://www.ly.gov.tw/Pages/List.aspx?nodeid=154",
-# "data" = df)
-# return(list_data)
-# },
-# error = function(error_message) {
-# message(error_message)
-# }
-# )
-# }
-get_meetings <- function(start_date = NULL, end_date = NULL, meeting_unit = NULL,
- verbose = TRUE) {
- check_internet()
-
- # 先檢查必要參數
- if(is.null(start_date) || is.null(end_date)) {
- message("\nBoth start_date and end_date must be provided.\n")
- }
-
- # 初始化進度顯示
- if(isTRUE(verbose)) {
- cat("\nInput Format Information:\n")
- cat("------------------------\n")
- cat("Date Format: YYYMMDD (ROC calendar)\n")
- cat("Example: 1090101 for 2020/01/01\n")
- cat("------------------------\n\n")
- cat("Downloading meeting records data...\n")
- pb <- txtProgressBar(min = 0, max = 100, style = 3)
- }
-
- # Update progress bar to 20%
- if(isTRUE(verbose)) setTxtProgressBar(pb, 20)
-
- api_check(start_date = check_date(start_date), end_date = check_date(end_date))
-
- # Update progress bar to 40%
- if(isTRUE(verbose)) setTxtProgressBar(pb, 40)
-
- set_api_url <- paste("https://www.ly.gov.tw/WebAPI/LegislativeSpeech.aspx?from=",
- start_date, "&to=", end_date,
- "&meeting_unit=", meeting_unit, "&mode=json", sep = "")
-
- tryCatch(
- {
- # Update progress bar to 60%
- if(isTRUE(verbose)) setTxtProgressBar(pb, 60)
-
- with_options(list(timeout = max(1000, getOption("timeout"))),{
- json_df <- jsonlite::fromJSON(set_api_url)
- })
-
- # Update progress bar to 80%
- if(isTRUE(verbose)) setTxtProgressBar(pb, 80)
-
- df <- tibble::as_tibble(json_df)
- attempt::stop_if_all(nrow(df) == 0, isTRUE, msg = "Query returned no data.")
- df["date_ad"] <- do.call("c", lapply(df$smeeting_date, transformed_date_meeting))
-
- # Update progress bar to 100% and show results
- if(isTRUE(verbose)) {
- setTxtProgressBar(pb, 100)
- close(pb)
- cat("\n\n")
- cat("====== Retrieved Information ======\n")
- cat("-----------------------------------\n")
- cat(" URL: \n", set_api_url, "\n")
- if(!is.null(meeting_unit)) {
- cat(" Meeting Unit: ", meeting_unit, "\n")
- }
- cat(" Date Range: ", as.character(check_date(start_date)),
- " to ", as.character(check_date(end_date)), "\n")
- cat(" Total Records: ", nrow(df), "\n")
-
- # Add meeting type distribution if available
- if("meeting_type" %in% colnames(df)) {
- meeting_counts <- table(df$meeting_type)
- cat("\nMeeting Type Distribution:\n")
- for(type in names(meeting_counts)) {
- cat(sprintf(" %s: %d\n", type, meeting_counts[type]))
- }
- }
- cat("===================================\n")
- }
-
- list_data <- list(
- "title" = "Meeting Records",
- "query_time" = Sys.time(),
- "retrieved_number" = nrow(df),
- "meeting_unit" = meeting_unit,
- "start_date_ad" = check_date(start_date),
- "end_date_ad" = check_date(end_date),
- "start_date" = start_date,
- "end_date" = end_date,
- "url" = set_api_url,
- "variable_names" = colnames(df),
- "manual_info" = "https://www.ly.gov.tw/Pages/List.aspx?nodeid=154",
- "data" = df
- )
- return(list_data)
- },
- error = function(error_message) {
- if(isTRUE(verbose)) {
- close(pb)
- cat("\nError occurred while fetching data:\n")
- cat(sprintf("Error: %s\n", error_message))
- }
- message(error_message)
- }
- )
-}
-
-
-#' The Meeting Records of Cross-caucus Session 黨團協商資訊
-#'
-#'@author David Liao (davidycliao@@gmail.com)
-#'
-#'@param start_date character Must be formatted in Minguo (ROC) calendar with three
-#'forward slashes between year, month and day, e.g. "106/10/20".
-#'
-#'@param end_date character Must be formatted in Minguo (ROC) calendar with three
-#'forward slashes between year, month and day, e.g. "109/01/10".
-#'
-#'@param verbose logical, indicates whether `get_caucus_meetings` should print out
-#'detailed output when retrieving the data.
-#'
-#'@return list, which contains: \describe{
-#' \item{`title`}{the meeting records of cross-caucus session}
-#' \item{`query_time`}{the query time}
-#' \item{`retrieved_number`}{the number of observation}
-#' \item{`meeting_unit`}{the meeting unit}
-#' \item{`start_date_ad`}{the start date in POSIXct}
-#' \item{`end_date_ad`}{the end date in POSIXct}
-#' \item{`start_date`}{the start date in ROC Taiwan calendar}
-#' \item{`url`}{the retrieved json url}
-#' \item{`variable_names`}{the variables of the tibble dataframe}
-#' \item{`manual_info`}{the official manual, \url{https://data.ly.gov.tw/getds.action?id=8}; or use get_variable_info("get_caucus_meetings")}
-#' \item{`data`}{a tibble dataframe, whose variables include:
-#' \describe{\item{`comYear`}{卷}
-#' \item{`comVolume`}{期}
-#' \item{`comBookId`}{冊別}
-#' \item{`term`}{屆別}
-#' \item{`sessionPeriod`}{會期}
-#' \item{`meetingTimes`}{臨時會會次}
-#' \item{`meetingDate`}{會議日期(民國年)}
-#' \item{`meetingName`}{會議名稱}
-#' \item{`subject`}{案由}
-#' \item{`pageStart`}{起始頁}
-#' \item{`pageEnd`}{結束頁}
-#' \item{`docUrl`}{檔案下載位置}
-#' \item{`htmlUrl`}{html網址}
-#' \item{`selectTerm`}{屆別期別篩選條件}
-#' }
-#' }
-#' }
-#'
-#'@import utils
-#'@importFrom attempt stop_if_all
-#'@importFrom jsonlite fromJSON
-#'@importFrom withr with_options
-#'
-#'@export
-#'@examples
-#' ## query the meeting records of cross-caucus session using a period of
-#' ## the dates in Taiwan ROC calender format with forward slash (/).
-#' ## 輸入「中華民國民年」下載「黨團協商」,輸入時間請依照該格式 "106/10/20",
-#' ## 需有「正斜線」做隔開。
-#'get_caucus_meetings(start_date = "106/10/20", end_date = "107/03/10")
-#'
-#'@details `get_caucus_meetings` produces a list, which contains `title`, `query_time`,
-#'`retrieved_number`, `meeting_unit`, `start_date_ad`, `end_date_ad`, `start_date`,
-#'`end_date`, `url`, `variable_names`, `manual_info` and `data.`
-#'
-#'@note To retrieve the user manual and more information about variable of the data
-#' frame, please use `get_variable_info("get_caucus_meetings")`
-#' or visit the API manual at \url{https://data.ly.gov.tw/getds.action?id=8}.
-#' 議事類:提供公報之黨團協商資訊 (自第8屆第1會期起)
-#'
-#'@seealso
-#'`get_variable_info("get_caucus_meetings")` Regarding Minguo calendar, please see \url{https://en.wikipedia.org/wiki/Republic_of_China_calendar}.
-#'
-#'@encoding UTF-8
-get_caucus_meetings <- function(start_date = NULL, end_date = NULL,
- verbose = TRUE) {
- # 檢查日期格式
- date_format_check <- function(date) {
- if (!is.null(date) && !grepl("^\\d{3}/\\d{2}/\\d{2}$", date)) {
- stop(paste("Invalid date format:", date, "\n",
- "Please use the format 'YYY/MM/DD' (ROC calendar),\n",
- "For example: '106/10/20'\n",
- "Where YYY is the ROC year (民國年)"))
- }
- }
-
- check_internet()
- date_format_check(start_date)
- date_format_check(end_date)
-
- if(isTRUE(verbose)) {
- cat("Downloading caucus meetings data...\n")
- pb <- txtProgressBar(min = 0, max = 100, style = 3)
- }
-
- # Update progress bar to 20%
- if(isTRUE(verbose)) setTxtProgressBar(pb, 20)
-
- api_check(start_date = transformed_date_meeting(start_date),
- end_date = transformed_date_meeting(end_date))
-
- # Update progress bar to 40%
- if(isTRUE(verbose)) setTxtProgressBar(pb, 40)
-
- set_api_url <- paste("https://data.ly.gov.tw/odw/ID8Action.action?comYear=&comVolume=&comBookId=&term=&sessionPeriod=&sessionTimes=&meetingTimes=&meetingDateS=",
- start_date, "&meetingDateE=", end_date, "&fileType=json", sep = "")
-
- tryCatch(
- {
- # Update progress bar to 60%
- if(isTRUE(verbose)) setTxtProgressBar(pb, 60)
-
- with_options(list(timeout = max(1000, getOption("timeout"))),{
- json_df <- jsonlite::fromJSON(set_api_url)
- })
-
- # Update progress bar to 80%
- if(isTRUE(verbose)) setTxtProgressBar(pb, 80)
-
- df <- tibble::as_tibble(json_df$dataList)
- attempt::stop_if_all(nrow(df) == 0, isTRUE, msg = "The query is unavailable.")
-
- # Update progress bar to 100% and close it
- if(isTRUE(verbose)) {
- setTxtProgressBar(pb, 100)
- close(pb)
- cat("\n\n") # Add newlines after progress bar
- cat("====== Retrieved Information ======\n")
- cat("-----------------------------------\n")
- cat(" URL: \n", set_api_url, "\n")
- cat(" Date Range: ", as.character(transformed_date_meeting(start_date)),
- " to ", as.character(transformed_date_meeting(end_date)), "\n")
- cat(" Total Meetings: ", nrow(df), "\n")
- cat("===================================\n")
- }
-
- list_data <- list("title" = "the meeting records of cross-caucus session",
- "query_time" = Sys.time(),
- "retrieved_number" = nrow(df),
- "start_date_ad" = transformed_date_meeting(start_date),
- "end_date_ad" = transformed_date_meeting(end_date),
- "start_date" = start_date,
- "end_date" = end_date,
- "url" = set_api_url,
- "variable_names" = colnames(df),
- "manual_info" = "https://data.ly.gov.tw/getds.action?id=8",
- "data" = df)
- return(list_data)
- },
- error = function(error_message) {
- if(isTRUE(verbose)) {
- close(pb)
- cat("\n")
- }
- message(error_message)
- }
- )
-}
-
-
-#' Video Information of Legislative Meetings and Committees
-#'
-#' @title The Video Information of Meetings and Committees 院會及委員會之委員發言片段相關影片資訊
-#'
-#' @description
-#' Retrieves video records and information of legislative meetings and committee sessions,
-#' including speech segments, meeting details, and video URLs. Data is available in both
-#' JSON and CSV formats from the 9th legislative term onwards.
-#'
-#' @param term numeric or NULL. Legislative term number (e.g., 10).
-#' Data is available from the 9th term onwards. Default is NULL.
-#'
-#' @param session_period numeric or NULL. Session period number (1-8).
-#' Default is NULL.
-#'
-#' @param start_date character. Must be formatted in ROC calendar with forward slashes
-#' between year, month and day, e.g., "110/10/01".
-#'
-#' @param end_date character. Must be formatted in ROC calendar with forward slashes
-#' between year, month and day, e.g., "110/10/30".
-#'
-#' @param verbose logical. Whether to display download progress and detailed information.
-#' Default is TRUE.
-#'
-#' @param format character. Data format to retrieve, either "json" or "csv".
-#' Default is "json".
-#'
-#' @return A list containing:
-#' \describe{
-#' \item{`title`}{speech video records}
-#' \item{`query_time`}{query timestamp}
-#' \item{`retrieved_number`}{number of videos retrieved}
-#' \item{`term`}{queried legislative term}
-#' \item{`session_period`}{queried session period}
-#' \item{`start_date`}{start date in ROC calendar}
-#' \item{`end_date`}{end date in ROC calendar}
-#' \item{`format`}{data format ("json" or "csv")}
-#' \item{`url`}{retrieved API URL}
-#' \item{`variable_names`}{variables in the tibble dataframe}
-#' \item{`manual_info`}{official manual URL}
-#' \item{`data`}{a tibble dataframe containing:
-#' \describe{
-#' \item{`term`}{屆別}
-#' \item{`sessionPeriod`}{會期}
-#' \item{`meetingDate`}{會議日期(西元年)}
-#' \item{`meetingTime`}{會議時間}
-#' \item{`meetingTypeName`}{主辦單位}
-#' \item{`meetingName`}{會議名稱}
-#' \item{`meetingContent`}{會議事由}
-#' \item{`legislatorName`}{委員姓名}
-#' \item{`areaName`}{選區名稱}
-#' \item{`speechStartTime`}{委員發言時間起}
-#' \item{`speechEndTime`}{委員發言時間迄}
-#' \item{`speechRecordUrl`}{發言紀錄網址}
-#' \item{`videoLength`}{影片長度}
-#' \item{`videoUrl`}{影片網址}
-#' \item{`selectTerm`}{屆別期別篩選條件}
-#' }
-#' }
-#' }
-#'
-#' @importFrom attempt stop_if_all
-#' @importFrom jsonlite fromJSON
-#' @importFrom withr with_options
-#' @importFrom readr read_csv
-#'
-#' @export
-#'
-#' @examples
-#' \dontrun{
-#' # Query video information in JSON format
-#' videos <- get_speech_video(
-#' term = 10,
-#' session_period = 4,
-#' start_date = "110/10/01",
-#' end_date = "110/10/30"
-#' )
-#'
-#' # Query in CSV format
-#' videos_csv <- get_speech_video(
-#' term = 10,
-#' session_period = 4,
-#' start_date = "110/10/01",
-#' end_date = "110/10/30",
-#' format = "csv"
-#' )
-#'
-#' # Query without specifying term/session
-#' videos <- get_speech_video(
-#' start_date = "110/10/01",
-#' end_date = "110/10/30"
-#' )
-#' }
-#'
-#' @details
-#' The function retrieves video information from legislative meetings and committee
-#' sessions. Data is available from the 9th legislative term onwards (2016/民國105年).
-#' The date parameters must use the ROC calendar format with forward slashes.
-#' Data can be retrieved in either JSON or CSV format.
-#'
-#' @note
-#' For more details about the data variables and API information,
-#' use `get_variable_info("get_speech_video")` or visit:
-#' \url{https://data.ly.gov.tw/getds.action?id=148}
-#'
-#' 會議類:提供立法院院會及委員會之委員發言片段相關影片資訊 (自第9屆第1會期起)。
-#'
-#' @seealso
-#' * `get_variable_info("get_speech_video")`
-#' * Example API URL: \url{https://data.ly.gov.tw/odw/ID148Action.action?term=10&sessionPeriod=4&meetingDateS=110/10/01&meetingDateE=110/10/30&meetingTime=&legislatorName=&fileType=csv}
-#'
-#'@encoding UTF-8
-get_speech_video <- function(term = NULL,
- session_period = NULL,
- start_date = NULL,
- end_date = NULL,
- verbose = TRUE,
- format = "json") {
- # Check internet connectivity
- check_internet()
-
- # Format validation
- format <- match.arg(format, c("json", "csv"))
-
- if(isTRUE(verbose)) {
- cat("\nInput Format Information:\n")
- cat("------------------------\n")
- cat("Term: Must be numeric (e.g., 8, 9, 10)\n")
- cat("Session Period: Must be numeric (1-8)\n")
- cat("Date Format: YYY/MM/DD (ROC calendar)\n")
- cat("Example: 110/10/01\n")
- cat("------------------------\n\n")
- cat("Downloading speech video data...\n")
- pb <- txtProgressBar(min = 0, max = 100, style = 3)
- }
-
- # Date validation
- if(is.null(start_date) || is.null(end_date)) {
- stop("Both start_date and end_date must be provided")
- }
-
- # Input data validation
- if(!is.null(term)) {
- term_str <- sprintf("%02d", as.numeric(term))
- } else {
- term_str <- ""
- }
-
- if(!is.null(session_period)) {
- session_str <- sprintf("%02d", as.numeric(session_period))
- } else {
- session_str <- ""
- }
-
- # Update progress bar to 20%
- if(isTRUE(verbose)) setTxtProgressBar(pb, 20)
-
- # Construct API URL
- set_api_url <- paste0("https://data.ly.gov.tw/odw/ID148Action.action?",
- "term=", term_str,
- "&sessionPeriod=", session_str,
- "&meetingDateS=", start_date,
- "&meetingDateE=", end_date,
- "&meetingTime=&legislatorName=&fileType=", format)
-
- # Update progress bar to 40%
- if(isTRUE(verbose)) setTxtProgressBar(pb, 40)
-
- tryCatch(
- {
- # Update progress bar to 60%
- if(isTRUE(verbose)) setTxtProgressBar(pb, 60)
-
- if(format == "json") {
- response <- try({
- json_df <- jsonlite::fromJSON(set_api_url)
- if(!is.null(json_df$dataList)) {
- df <- tibble::as_tibble(json_df$dataList)
- } else {
- df <- tibble::tibble()
- }
- }, silent = TRUE)
- } else {
- response <- try({
- df <- readr::read_csv(set_api_url, show_col_types = FALSE)
- }, silent = TRUE)
- }
-
- # Update progress bar to 80%
- if(isTRUE(verbose)) setTxtProgressBar(pb, 80)
-
- # Data validation
- if(nrow(df) == 0) {
- if(isTRUE(verbose)) {
- setTxtProgressBar(pb, 100)
- close(pb)
- cat("\n\n")
- cat("====== Query Result ======\n")
- cat("-------------------------\n")
- cat("No records found. Please check:\n")
- cat("1. Date format (YYY/MM/DD)\n")
- cat("2. Term and session period\n")
- cat("3. Data availability\n")
- cat("-------------------------\n")
- }
- return(NULL)
- }
-
- # Update progress bar to 100%
- if(isTRUE(verbose)) {
- setTxtProgressBar(pb, 100)
- close(pb)
- cat("\n\n")
- cat("====== Retrieved Information ======\n")
- cat("-----------------------------------\n")
- cat(" Retrieved URL: \n", set_api_url, "\n")
- cat(" Term: ", term_str, "\n")
- if(!is.null(session_period)) {
- cat(" Session Period: ", session_period, "\n")
- }
- cat(" Date Range: ", start_date, " to ", end_date, "\n")
- cat(" Total Videos: ", nrow(df), "\n")
- cat(" Format: ", toupper(format), "\n")
- cat("===================================\n")
- }
-
- # Return data
- list_data <- list(
- "title" = "speech video records",
- "query_time" = Sys.time(),
- "retrieved_number" = nrow(df),
- "term" = term_str,
- "session_period" = session_str,
- "start_date" = start_date,
- "end_date" = end_date,
- "format" = format,
- "url" = set_api_url,
- "variable_names" = colnames(df),
- "manual_info" = "https://data.ly.gov.tw/getds.action?id=148",
- "data" = df
- )
- return(list_data)
- },
- error = function(error_message) {
- if(isTRUE(verbose)) {
- close(pb)
- cat("\nError occurred:\n")
- cat(as.character(error_message), "\n")
- }
- return(NULL)
- }
- )
-}
-
-
-#' The Records of National Public Debates 國是論壇
-#'
-#' @param term numeric or NULL. The default is set to 10. Legislative term number
-#' (e.g., 10). Data is officially available from the 8th term onwards, but
-#' testing shows data starts from the 10th term.
-#'
-#' @param session_period numeric or NULL. Session period number (1-8). Default is NULL.
-#' Use `review_session_info()` to see available session periods in ROC calendar.
-#'
-#' @param verbose logical. Whether to display download progress and detailed information.
-#' Default is TRUE.
-#'
-#' @return A list containing:
-#' \describe{
-#' \item{`title`}{public debates records}
-#' \item{`query_time`}{query timestamp}
-#' \item{`retrieved_number`}{number of records retrieved}
-#' \item{`retrieved_term`}{queried legislative term}
-#' \item{`url`}{retrieved API URL}
-#' \item{`variable_names`}{variables in the tibble dataframe}
-#' \item{`manual_info`}{official manual URL or use get_variable_info("get_public_debates")}
-#' \item{`data`}{a tibble dataframe containing:
-#' \describe{
-#' \item{`term`}{屆別}
-#' \item{`sessionPeriod`}{會期}
-#' \item{`sessionTimes`}{會次}
-#' \item{`meetingTimes`}{臨時會會次}
-#' \item{`dateTimeDesc`}{日期時間說明}
-#' \item{`meetingRoom`}{會議地點}
-#' \item{`chairman`}{主持人}
-#' \item{`legislatorName`}{委員姓名}
-#' \item{`speakType`}{發言類型(paper:書面發言,speak:發言)}
-#' \item{`content`}{內容}
-#' \item{`selectTerm`}{屆別期別篩選條件}
-#' }
-#' }
-#' }
-#'
-#' @import utils
-#' @importFrom attempt stop_if_all
-#' @importFrom jsonlite fromJSON
-#' @importFrom withr with_options
-#'
-#' @export
-#'
-#' @examples
-#' # Query public debates for term 10, session period 2
-#' debates <- get_public_debates(term = 10, session_period = 2)
-#'
-#' # Query without specifying session period
-#' debates <- get_public_debates(term = 10)
-#'
-#' @details
-#' The function retrieves records from the National Public Debates (國是論壇),
-#' including both spoken and written opinions. While officially available from
-#' the 8th legislative term, testing indicates data is only available from
-#' the 10th term onwards.
-#'
-#' @note
-#' For more details about the data variables and API information,
-#' use `get_variable_info("get_public_debates")` or visit the API manual at
-#' \url{https://data.ly.gov.tw/getds.action?id=7}.
-#' 議事類: 提供公報之國是論壇資訊,並包含書面意見。
-#' 自第8屆第1會期起,但實測資料從第10屆。
-#'
-#' @seealso
-#' * `get_variable_info("get_public_debates")`
-#' * `review_session_info()`
-#' * For ROC calendar information: \url{https://en.wikipedia.org/wiki/Republic_of_China_calendar}
-#'
-#' @encoding UTF-8
-get_public_debates <- function(term = NULL, session_period = NULL, verbose = TRUE) {
- check_internet()
-
- if(isTRUE(verbose)) {
- cat("\nInput Format Information:\n")
- cat("------------------------\n")
- cat("Term: Must be numeric (e.g., 8, 9, 10)\n")
- cat("Session Period: Must be numeric (1-8)\n")
- cat("------------------------\n\n")
- cat("Downloading public debates data...\n")
- pb <- txtProgressBar(min = 0, max = 100, style = 3)
- }
-
- # Update progress bar to 20%
- if(isTRUE(verbose)) setTxtProgressBar(pb, 20)
-
- if (is.null(term)) {
- set_api_url <- paste("https://data.ly.gov.tw/odw/ID7Action.action?term=",
- term, "&sessionPeriod=",
- "&sessionTimes=&meetingTimes=&legislatorName=&speakType=&fileType=json",
- sep = "")
- message(" term is not defined...\n You are now requesting full data from the API. Please make sure your connectivity is stable until its completion.\n")
- } else {
- attempt::stop_if_all(term, is.character, msg = "\nPlease use numeric format only.")
- if (length(term) == 1) {
- term <- sprintf("%02d", as.numeric(term))
- } else if (length(term) > 1) {
- if(isTRUE(verbose)) close(pb)
- term <- paste(sprintf("%02d", as.numeric(term)), collapse = "&")
- message("The API is unable to query multiple terms and the retrieved data might not be complete.")
- }
- }
-
- # Update progress bar to 40%
- if(isTRUE(verbose)) setTxtProgressBar(pb, 40)
-
- set_api_url <- paste("https://data.ly.gov.tw/odw/ID7Action.action?term=",
- term, "&sessionPeriod=",
- sprintf("%02d", as.numeric(session_period)),
- "&sessionTimes=&meetingTimes=&legislatorName=&speakType=&fileType=json",
- sep = "")
-
- tryCatch(
- {
- # Update progress bar to 60%
- if(isTRUE(verbose)) setTxtProgressBar(pb, 60)
-
- with_options(list(timeout = max(1000, getOption("timeout"))),{
- json_df <- jsonlite::fromJSON(set_api_url)
- })
-
- # Update progress bar to 80%
- if(isTRUE(verbose)) setTxtProgressBar(pb, 80)
-
- df <- tibble::as_tibble(json_df$dataList)
- attempt::stop_if_all(nrow(df) == 0, isTRUE, msg = "The query is unavailable.")
-
- # Update progress bar to 100%
- if(isTRUE(verbose)) {
- setTxtProgressBar(pb, 100)
- close(pb)
- cat("\n\n") # Add newlines after progress bar
- cat("====== Retrieved Information ======\n")
- cat("-----------------------------------\n")
- cat(" Retrieved URL: \n", set_api_url, "\n")
- cat(" Term: ", term, "\n")
- if(!is.null(session_period)) {
- cat(" Session Period: ", session_period, "\n")
- }
- cat(" Total Records: ", nrow(df), "\n")
- if("legislatorName" %in% colnames(df)) {
- unique_legislators <- length(unique(df$legislatorName))
- cat(" Unique Legislators: ", unique_legislators, "\n")
- }
- cat("===================================\n")
- }
-
- list_data <- list(
- "title" = "public debates records",
- "query_time" = Sys.time(),
- "retrieved_number" = nrow(df),
- "retrieved_term" = term,
- "url" = set_api_url,
- "variable_names" = colnames(df),
- "manual_info" = "https://data.ly.gov.tw/getds.action?id=7",
- "data" = df
- )
- return(list_data)
- },
- error = function(error_message) {
- if(isTRUE(verbose)) {
- close(pb)
- cat("\n")
- }
- message(error_message)
- }
- )
-}
-
-#' The Records of Reviewed Items in the Committees 委員會會議審查之議案項目
-#'
-#'@author David Yen-Chieh Liao
-#'
-#'@param term numeric or null. Data is available only from the 8th term.
-#'The default is set to 10. 參數必須為數值。提供委員會會議審查之議案項目。(自第10屆第1會期起)
-#'
-#'@param session_period integer, numeric or NULL.
-#'`review_session_info()` provides each session period's available options based on the
-#' Minguo (Taiwan) calendar.
-#'
-#'@param verbose logical. This indicates whether `get_executive_response` should
-#'print a detailed output during data retrieval. Default is TRUE.
-#'
-#'@return A list containing:
-#' \item{`title`}{Records of questions answered by executives}
-#' \item{`query_time`}{Time of query}
-#' \item{`retrieved_number`}{Total number of observations}
-#' \item{`retrieved_term`}{Queried term}
-#' \item{`url`}{Retrieved JSON URL}
-#' \item{`variable_names`}{Variables of the tibble dataframe}
-#' \item{`manual_info`}{Official manual, \url{https://data.ly.gov.tw/getds.action?id=46}; or use get_variable_info("get_committee_record")}
-#' \item{`data`}{A tibble dataframe with variables:
-#' \describe{
-#' \item{`term`}{Term number}
-#' \item{`sessionPeriod`}{Session}
-#' \item{`meetingNo`}{Meeting number}
-#' \item{`billNo`}{Bill number}
-#' \item{`selectTerm`}{Term selection filter}
-#' }
-#' }
-#'
-#'@importFrom attempt stop_if_all
-#'@importFrom jsonlite fromJSON
-#'@importFrom withr with_options
-#'
-#'@export
-#'
-#'@examples
-#' ## Query the committee record by term and session period.
-#' ## 輸入「立委屆期」與「會期」下載「委員會審議之議案」
-#'get_committee_record(term = 10, session_period = 1)
-#'
-#'@details `get_committee_record` provides a list which includes `title`,
-#'`query_time`, `retrieved_number`, `retrieved_term`, `url`, `variable_names`,
-#' `manual_info`, and `data`.
-#'
-#'@note
-#' To access the user manual and more information about the data frame's variables,
-#' please refer to `get_variable_info("get_committee_record")` or check the API manual at
-#' \url{https://data.ly.gov.tw/getds.action?id=46}.
-#' This provides agenda items reviewed in committee meetings (from the 10th term, 1st session onwards).
-#'
-#'@seealso
-#'`get_variable_info("get_committee_record")`, `review_session_info()`
-#' The Records of Reviewed Items in the Committees 委員會會議審查之議案項目
-#'
-#'@author David Yen-Chieh Liao
-#'
-#'@param term numeric or null. Data is available only from the 8th term.
-#'The default is set to 10. 參數必須為數值。提供委員會會議審查之議案項目。(自第10屆第1會期起)
-#'
-#'@param session_period integer, numeric or NULL.
-#'`review_session_info()` provides each session period's available options based on the
-#' Minguo (Taiwan) calendar.
-#'
-#'@param verbose logical. This indicates whether `get_executive_response` should
-#'print a detailed output during data retrieval. Default is TRUE.
-#'
-#'@return A list containing:
-#' \item{`title`}{Records of questions answered by executives}
-#' \item{`query_time`}{Time of query}
-#' \item{`retrieved_number`}{Total number of observations}
-#' \item{`retrieved_term`}{Queried term}
-#' \item{`url`}{Retrieved JSON URL}
-#' \item{`variable_names`}{Variables of the tibble dataframe}
-#' \item{`manual_info`}{Official manual, \url{https://data.ly.gov.tw/getds.action?id=46}; or use get_variable_info("get_committee_record")}
-#' \item{`data`}{A tibble dataframe with variables:
-#' \describe{
-#' \item{`term`}{Term number}
-#' \item{`sessionPeriod`}{Session}
-#' \item{`meetingNo`}{Meeting number}
-#' \item{`billNo`}{Bill number}
-#' \item{`selectTerm`}{Term selection filter}
-#' }
-#' }
-#'
-#'@import utils
-#'@importFrom attempt stop_if_all
-#'@importFrom jsonlite fromJSON
-#'@importFrom withr with_options
-#'
-#'@export
-#'
-#'@examples
-#' ## Query the committee record by term and session period.
-#' ## 輸入「立委屆期」與「會期」下載「委員會審議之議案」
-#'get_committee_record(term = 10, session_period = 1)
-#'
-#'@details `get_committee_record` provides a list which includes `title`,
-#'`query_time`, `retrieved_number`, `retrieved_term`, `url`, `variable_names`,
-#' `manual_info`, and `data`.
-#'
-#'@note
-#' To access the user manual and more information about the data frame's variables,
-#' please refer to `get_variable_info("get_committee_record")` or check the API manual at
-#' \url{https://data.ly.gov.tw/getds.action?id=46}.
-#' This provides agenda items reviewed in committee meetings (from the 10th term, 1st session onwards).
-#'
-#'@seealso
-#'`get_variable_info("get_committee_record")`, `review_session_info()`
-#'
-#' @encoding UTF-8
-get_committee_record <- function(term = 10, session_period = NULL, verbose = TRUE) {
- check_internet()
-
- if(isTRUE(verbose)) {
- cat("\nInput Format Information:\n")
- cat("------------------------\n")
- cat("Term: Must be numeric (e.g., 8, 9, 10)\n")
- cat("Session Period: Must be numeric (1-8)\n")
- cat("------------------------\n\n")
- cat("Downloading committee records data...\n")
- pb <- txtProgressBar(min = 0, max = 100, style = 3)
- }
-
- # Update progress bar to 20%
- if(isTRUE(verbose)) setTxtProgressBar(pb, 20)
-
- if (is.null(term)) {
- set_api_url <- paste("https://data.ly.gov.tw/odw/ID46Action.action?term=",
- term, "&sessionPeriod=",
- "&sessionTimes=01&meetingTimes=&fileType=json", sep = "")
- message(" term is not defined...\n You are now requesting full data from the API. Please make sure your connectivity is stable until its completion.\n")
- } else {
- attempt::stop_if_all(term, is.character, msg = "use numeric format only.")
- if (length(term) == 1) {
- term <- sprintf("%02d", as.numeric(term))
- } else if (length(term) > 1) {
- if(isTRUE(verbose)) close(pb)
- term <- paste(sprintf("%02d", as.numeric(term)), collapse = "&")
- message("The API is unable to query multiple terms and the retrieved data might not be complete.")
- }
- }
-
- # Update progress bar to 40%
- if(isTRUE(verbose)) setTxtProgressBar(pb, 40)
-
- set_api_url <- paste("https://data.ly.gov.tw/odw/ID46Action.action?term=",
- term,
- "&sessionPeriod=", sprintf("%02d", as.numeric(session_period)),
- "&sessionTimes=01&meetingTimes=&fileType=json", sep = "")
-
- tryCatch(
- {
- # Update progress bar to 60%
- if(isTRUE(verbose)) setTxtProgressBar(pb, 60)
-
- with_options(list(timeout = max(1000, getOption("timeout"))),{
- json_df <- jsonlite::fromJSON(set_api_url)
- })
-
- # Update progress bar to 80%
- if(isTRUE(verbose)) setTxtProgressBar(pb, 80)
-
- df <- tibble::as_tibble(json_df$dataList)
- attempt::stop_if_all(nrow(df) == 0, isTRUE, msg = "The query is unavailable.")
-
- # Update progress bar to 100%
- if(isTRUE(verbose)) {
- setTxtProgressBar(pb, 100)
- close(pb)
- cat("\n\n") # Add newlines after progress bar
- cat("====== Retrieved Information ======\n")
- cat("-----------------------------------\n")
- cat(" Retrieved URL: \n", set_api_url, "\n")
- cat(" Term: ", term, "\n")
- if(!is.null(session_period)) {
- cat(" Session Period: ", session_period, "\n")
- }
- cat(" Total Records: ", nrow(df), "\n")
-
- if("committee" %in% colnames(df)) {
- committee_counts <- table(df$committee)
- cat("\nCommittee Distribution:\n")
- for(comm in names(committee_counts)) {
- cat(sprintf(" %s: %d\n", comm, committee_counts[comm]))
- }
- }
- cat("===================================\n")
- }
-
- list_data <- list(
- "title" = "the records of reviewed items in the committees",
- "query_time" = Sys.time(),
- "retrieved_number" = nrow(df),
- "retrieved_term" = term,
- "url" = set_api_url,
- "variable_names" = colnames(df),
- "manual_info" = "https://data.ly.gov.tw/getds.action?id=46",
- "data" = df
- )
- return(list_data)
- },
- error = function(error_message) {
- if(isTRUE(verbose)) {
- close(pb)
- cat("\n")
- }
- message(error_message)
- }
- )
-}
diff --git a/.Rproj.user/763C8F27/sources/session-ab45fd2f/7BDEAA0D b/.Rproj.user/763C8F27/sources/session-ab45fd2f/7BDEAA0D
deleted file mode 100644
index 47ccf363..00000000
--- a/.Rproj.user/763C8F27/sources/session-ab45fd2f/7BDEAA0D
+++ /dev/null
@@ -1,26 +0,0 @@
-{
- "id": "7BDEAA0D",
- "path": "~/Dropbox/My Packages/legisTaiwan/.github/workflows/R-CMD-check.yaml",
- "project_path": ".github/workflows/R-CMD-check.yaml",
- "type": "yaml",
- "hash": "0",
- "contents": "",
- "dirty": false,
- "created": 1735335486554.0,
- "source_on_save": false,
- "relative_order": 3,
- "properties": {
- "source_window_id": "",
- "Source": "Source",
- "cursorPosition": "97,0",
- "scrollLine": "55"
- },
- "folds": "",
- "lastKnownWriteTime": 1735335496,
- "encoding": "UTF-8",
- "collab_server": "",
- "source_window": "",
- "last_content_update": 1735335496201,
- "read_only": false,
- "read_only_alternatives": []
-}
\ No newline at end of file
diff --git a/.Rproj.user/763C8F27/sources/session-ab45fd2f/7BDEAA0D-contents b/.Rproj.user/763C8F27/sources/session-ab45fd2f/7BDEAA0D-contents
deleted file mode 100644
index db220a53..00000000
--- a/.Rproj.user/763C8F27/sources/session-ab45fd2f/7BDEAA0D-contents
+++ /dev/null
@@ -1,97 +0,0 @@
-# Workflow derived from https://github.com/r-lib/actions/tree/v2/examples
-# Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help
-# on:
-# push:
-# branches: [main, master]
-# pull_request:
-# branches: [main, master]
-#
-# name: R-CMD-check
-#
-# jobs:
-# R-CMD-check:
-# runs-on: ${{ matrix.config.os }}
-#
-# name: ${{ matrix.config.os }} (${{ matrix.config.r }})
-#
-# strategy:
-# fail-fast: false
-# matrix:
-# config:
-# - {os: macos-latest, r: 'release'}
-# - {os: windows-latest, r: 'release'}
-# - {os: ubuntu-latest, r: 'devel', http-user-agent: 'release'}
-# - {os: ubuntu-latest, r: 'release'}
-# env:
-# GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
-# R_KEEP_PKG_SOURCE: yes
-#
-# steps:
-# - uses: actions/checkout@v2
-#
-# - uses: r-lib/actions/setup-pandoc@v2
-#
-# - uses: r-lib/actions/setup-r@v2
-# with:
-# r-version: ${{ matrix.config.r }}
-# http-user-agent: ${{ matrix.config.http-user-agent }}
-# use-public-rspm: true
-#
-# - uses: r-lib/actions/setup-r-dependencies@v2
-# with:
-# extra-packages: any::rcmdcheck
-# needs: check
-#
-# - uses: r-lib/actions/check-r-package@v2
-# with:
-# upload-snapshots: true
-
-name: R-CMD-check
-
-jobs:
- R-CMD-check:
- runs-on: ${{ matrix.config.os }}
- name: ${{ matrix.config.os }} (${{ matrix.config.r }})
-
- strategy:
- fail-fast: false
- matrix:
- config:
- - {os: macos-latest, r: 'release'}
- - {os: windows-latest, r: 'release'}
- - {os: ubuntu-latest, r: 'devel', http-user-agent: 'release'}
- - {os: ubuntu-latest, r: 'release'}
-
- env:
- GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
- R_KEEP_PKG_SOURCE: yes
- _R_CHECK_ASCII_CODE_: FALSE
- _R_CHECK_RD_ASCII_CODE_: FALSE
- R_CHECK_IGNORE_ASCII: TRUE
-
- steps:
- - uses: actions/checkout@v3
-
- - uses: r-lib/actions/setup-pandoc@v2
-
- - uses: r-lib/actions/setup-r@v2
- with:
- r-version: ${{ matrix.config.r }}
- http-user-agent: ${{ matrix.config.http-user-agent }}
- use-public-rspm: true
-
- - uses: r-lib/actions/setup-r-dependencies@v2
- with:
- extra-packages: any::rcmdcheck
- needs: check
-
- - uses: r-lib/actions/check-r-package@v2
- env:
- _R_CHECK_ASCII_CODE_: FALSE
- _R_CHECK_RD_ASCII_CODE_: FALSE
- R_CHECK_IGNORE_ASCII: TRUE
- with:
- args: 'c("--no-manual", "--no-codoc", "--no-examples", "--ignore-ascii")'
- error-on: '"error"'
- upload-snapshots: true
- check-dir: check
diff --git a/.Rproj.user/763C8F27/sources/session-ab45fd2f/85DCA94A-contents b/.Rproj.user/763C8F27/sources/session-ab45fd2f/85DCA94A-contents
deleted file mode 100644
index e946a839..00000000
--- a/.Rproj.user/763C8F27/sources/session-ab45fd2f/85DCA94A-contents
+++ /dev/null
@@ -1,60 +0,0 @@
-
-
-
-## Real-time and Archives of Taiwan Legislative Data in R
-
-
-
-[![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` 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. Also, consider writing a batch retrieval process with
-appropriate handlers to track the progress of file input, ensuring the
-completeness of the requested data.
-
-
-
-
-
-
-
-### Get Started with Using [`remotes`](https://github.com/r-lib/remotes):
-
-``` r
-install.packages("remotes")
-remotes::install_github("davidycliao/legisTaiwan", force = TRUE)
-```
-
- library(legisTaiwan)
- #> ## legisTaiwan ##
- #> ## An R package connecting to the Taiwan Legislative API. ##
-
-
-
-### Notice:
-
-
-
-`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. 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/.Rproj.user/763C8F27/sources/session-ab45fd2f/870D6CE4-contents b/.Rproj.user/763C8F27/sources/session-ab45fd2f/870D6CE4-contents
deleted file mode 100644
index 18e2b451..00000000
--- a/.Rproj.user/763C8F27/sources/session-ab45fd2f/870D6CE4-contents
+++ /dev/null
@@ -1,248 +0,0 @@
-#'@title Check Each Function's Manual
-#'@author David Liao (davidycliao@@gmail.com)
-#'
-#'@description `get_variable_info` generate each API's endpoint manual returned
-#'from the website of Taiwan Legislative Yuan. The avalaible options is: `get_bills`,
-#'`get_bills_2`, `get_meetings`, `get_caucus_meetings`, `get_speech_video` ,
-#'`get_public_debates`, `get_parlquestions`, `get_executive_response` and
-#'`get_committee_record`.
-#'
-#'@param param_ characters. Must be one of options below: \describe{
-#' \item{get_bills}{get_bills: the records of the bills, see \url{https://data.ly.gov.tw/getds.action?id=6}}
-#' \item{get_bills_2}{the records of legislators and the government proposals, see \url{https://data.ly.gov.tw/getds.action?id=6}}
-#' \item{get_meetings}{the spoken meeting records, see \url{https://www.ly.gov.tw/Pages/List.aspx?nodeid=154}}
-#' \item{get_caucus_meetings}{the meeting records of cross-caucus session, see \url{https://data.ly.gov.tw/getds.action?id=8}}
-#' \item{get_speech_video}{the full video information of meetings and committees, see \url{https://data.ly.gov.tw/getds.action?id=148}}
-#' \item{get_public_debates}{the records of national public debates, see \url{https://data.ly.gov.tw/getds.action?id=7}}
-#' \item{get_parlquestions}{the records of parliamentary questions, see \url{https://data.ly.gov.tw/getds.action?id=6}}
-#' \item{get_executive_response}{the records of the questions answered by the executives, see \url{https://data.ly.gov.tw/getds.action?id=2}}
-#'}
-#'
-#'@return list \describe{
-#' \item{`page_info`}{information of the end point}
-#' \item{`reference_url`}{the url of the page}}
-#'
-#'@details `get_variable_info` produces a list, which contains `page_info` and `reference_url`.
-#'
-#'@importFrom attempt stop_if_all
-#'@importFrom jsonlite fromJSON
-#'@importFrom rvest html_text2 read_html
-#'@importFrom tibble as_tibble
-#'
-#' @export
-#'
-#' @seealso `review_session_info()`.
-#'
-#' @examples
-#' \dontrun{
-#' get_variable_info("get_bills")
-#' }
-# get_variable_info <- function(param_) {
-# check_internet()
-# attempt::stop_if_all(website_availability(), isFALSE, msg = "the error from the API.")
-# attempt::stop_if_all(param_, is.numeric, msg = "use string format only.")
-# attempt::stop_if_all(param_, is.null, msg = "use correct funtion names.")
-# attempt::stop_if(param_ , ~ length(.x) >1, msg = "only allowed to query one function.")
-# if (param_ == "get_parlquestions") {
-# url <- "https://data.ly.gov.tw/getds.action?id=6"
-# }
-# else if (param_ == "get_legislators") {
-# url <- "https://data.ly.gov.tw/getds.action?id=16"
-# }
-# else if (param_ == "get_committee_record") {
-# url <- "https://data.ly.gov.tw/getds.action?id=46"
-# }
-# else if (param_ == "get_executive_response") {
-# url <- "https://data.ly.gov.tw/getds.action?id=2"
-# }
-# else if (param_ == "get_caucus_meetings") {
-# url <- "https://data.ly.gov.tw/getds.action?id=8"
-# }
-# else if (param_ == "get_speech_video") {
-# url <- "https://data.ly.gov.tw/getds.action?id=148"
-# }
-# else if (param_ == "get_bills_2") {
-# url <- "https://data.ly.gov.tw/getds.action?id=20"
-# }
-# else if (param_ == "get_public_debates") {
-# url <- "https://data.ly.gov.tw/getds.action?id=7"
-# }
-# else if (param_ %in% c("get_bills", "get_meetings")) {
-# if (param_ == "get_meetings") {
-# url <- "https://www.ly.gov.tw/Pages/List.aspx?nodeid=154"
-# }
-# else if (param_ == "get_bills") {
-# url <- "https://www.ly.gov.tw/Pages/List.aspx?nodeid=153"
-# }
-# html_info <- rvest::html_text2(rvest::html_nodes(rvest::html_nodes(rvest::read_html(url), "*[id='form_Query']"), "div") )
-# page_info <- list(page_info = strsplit(html_info[14], split = "\n")[[1]], reference_url = url)
-# return(page_info)
-# }
-# else {
-# stop("Use correct funtion names below in character format:
-# get_bills: the records of the bills
-# get_bills_2: the records of legislators and the government proposals
-# get_meetings: the spoken meeting records
-# get_caucus_meetings: the meeting records of cross-caucus session
-# get_speech_video: the full video information of meetings and committees
-# get_public_debates: the records of national public debates
-# get_parlquestions: the records of parliamentary questions
-# get_executive_response: the records of the questions answered by the executives")
-# }
-# html <- rvest::html_nodes(rvest::read_html(url), "*[id='content']")
-# title <- gsub("[[:space:]]", "", rvest::html_text2(rvest::html_nodes(html, "h2")))
-#
-# content <- gsub("[[:space:]]", "", rvest::html_text2(rvest::html_nodes(html, "span")))
-# df <- data.frame(content[seq(1, length(content), 2 )],
-# content[seq(1, length(content) + 1, 2 ) -1])
-# colnames(df) <- c(title[2], title[1])
-# df <- tibble::as_tibble(df)
-# page_info <- list(page_info = df, reference_url = url)
-# return(page_info)
-# }
-
-get_variable_info <- function(param_) {
- # Ensure internet and website availability
- check_internet()
- attempt::stop_if_not(website_availability(), msg = "the error from the API.")
-
- # Parameter checks
- attempt::stop_if(param_, is.numeric, msg = "use string format only.")
- attempt::stop_if(param_, is.null, msg = "use correct function names.")
- attempt::stop_if(param_, ~ length(.x) > 1, msg = "only allowed to query one function.")
-
- # Dictionary for URL mapping
- url_mapping <- list(
- get_parlquestions = "https://data.ly.gov.tw/getds.action?id=6",
- get_legislators = "https://data.ly.gov.tw/getds.action?id=16",
- get_committee_record = "https://data.ly.gov.tw/getds.action?id=46",
- get_executive_response = "https://data.ly.gov.tw/getds.action?id=2",
- get_caucus_meetings = "https://data.ly.gov.tw/getds.action?id=8",
- get_speech_video = "https://data.ly.gov.tw/getds.action?id=148",
- get_bills_2 = "https://data.ly.gov.tw/getds.action?id=20",
- get_public_debates = "https://data.ly.gov.tw/getds.action?id=7"
- )
- if (!(param_ %in% names(url_mapping) || param_ %in% c("get_bills", "get_meetings"))) {
- stop("Use correct function names below in character format:
- get_bills: the records of the bills
- get_bills_2: the records of legislators and the government proposals
- get_meetings: the spoken meeting records
- get_caucus_meetings: the meeting records of cross-caucus session
- get_speech_video: the full video information of meetings and committees
- get_public_debates: the records of national public debates
- get_parlquestions: the records of parliamentary questions
- get_executive_response: the records of the questions answered by the executives")
- }
-
-
- # Fetch URL from dictionary or process special cases
- if (param_ %in% names(url_mapping)) {
- url <- url_mapping[[param_]]
- } else if (param_ == "get_meetings") {
- url <- "https://www.ly.gov.tw/Pages/List.aspx?nodeid=154"
- } else if (param_ == "get_bills") {
- url <- "https://www.ly.gov.tw/Pages/List.aspx?nodeid=153"
- } else {
- stop("Use correct function names below in character format.")
- }
-
- if (param_ %in% c("get_bills", "get_meetings")) {
- html_info <- rvest::html_text2(rvest::html_nodes(rvest::html_nodes(rvest::read_html(url), "*[id='form_Query']"), "div"))
- page_info <- list(page_info = strsplit(html_info[14], split = "\n")[[1]], reference_url = url)
- return(page_info)
- }
-
- html <- rvest::html_nodes(rvest::read_html(url), "*[id='content']")
- title <- gsub("[[:space:]]", "", rvest::html_text2(rvest::html_nodes(html, "h2")))
-
- content <- gsub("[[:space:]]", "", rvest::html_text2(rvest::html_nodes(html, "span")))
- df <- data.frame(content[seq(1, length(content), 2)],
- content[seq(1, length(content) + 1, 2) - 1])
- colnames(df) <- c(title[2], title[1])
- df <- tibble::as_tibble(df)
- page_info <- list(page_info = df, reference_url = url)
-
- return(page_info)
-}
-
-
-#'@title Check Session Periods in Each Year (Minguo Calendar)
-#'
-#'@author David Liao (davidycliao@@gmail.com)
-#'
-#'@details `review_session_info` produces a dataframe, displaying each session
-#'period in year formatted in Minguo (Taiwan) calendar.
-#'
-#'@param term numeric
-#'
-#'@return dataframe
-#'
-#'@importFrom attempt stop_if_all
-#'@importFrom rvest html_text2 read_html
-#'@importFrom tibble as_tibble
-#'
-#' @seealso
-#' Regarding Minguo calendar, please see \url{https://en.wikipedia.org/wiki/Republic_of_China_calendar}.
-#'
-#' @examples
-#' \dontrun{
-#' review_session_info(7)
-#' }
-review_session_info <- function(term) {
- # Input validation
- if(missing(term)) {
- stop("Term parameter is required")
- }
-
- attempt::stop_if_not(website_availability2(),
- msg = "API connection error. Please check your internet connection.")
-
- attempt::stop_if(term, is.null,
- msg = "Term cannot be NULL. Please provide a valid term number (1-11).")
-
- attempt::stop_if_not(term %in% 1:11,
- msg = paste("Invalid term:", term,
- "\nPlease provide a term number between 1 and 11."))
-
- # Construct URL
- url <- sprintf("https://npl.ly.gov.tw/do/www/appDate?status=0&expire=%02d&startYear=0",
- as.numeric(term))
-
- tryCatch({
- # Parse HTML
- html_ <- rvest::html_nodes(rvest::read_html(url),
- "*[class='section_wrapper']")
-
- # Extract titles
- title <- stringr::str_split_1(
- rvest::html_text2(
- rvest::html_nodes(html_, "[class='tt_titlebar2']")
- ),
- "\t\r"
- )[1:2]
-
- # Extract rows
- odd_rows <- rvest::html_text2(
- rvest::html_nodes(html_, "[class='tt_listrow_odd']")
- )
- even_rows <- rvest::html_text2(
- rvest::html_nodes(html_, "[class='tt_listrow_even']")
- )
-
- # Process data
- data <- lapply(
- lapply(c(odd_rows, even_rows),
- function(x) stringr::str_split_1(x, "\r\r")),
- function(x) gsub("[[:space:]]", "", x)
- )
-
- # Create dataframe
- df <- do.call(rbind, data)
- colnames(df) <- title
-
- return(tibble::as_tibble(df))
- },
- error = function(e) {
- stop(paste("Error retrieving session information:", e$message))
- })
-}
diff --git a/.Rproj.user/763C8F27/sources/session-ab45fd2f/8F3300C0-contents b/.Rproj.user/763C8F27/sources/session-ab45fd2f/8F3300C0-contents
deleted file mode 100644
index 5d05ee61..00000000
--- a/.Rproj.user/763C8F27/sources/session-ab45fd2f/8F3300C0-contents
+++ /dev/null
@@ -1,136 +0,0 @@
-
-
-
-## Real-time and Archives of Taiwan Legislative Data in R
-
-
-
-[![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 streamline access to real-time archives of
-Taiwan’s legislative data, drawing inspiration from the UK’s
-TheyWorkForYou API. By providing straightforward access to the Taiwan
-Legislative Yuan API in R, this package not only aims to enhance
-legislative accountability and public transparency but also serves as a
-powerful tool for academic research. Scholars can easily retrieve and
-analyze legislative data including voting records, parliamentary
-questions, and bill proposals, facilitating quantitative research and
-empirical analysis. As the package interfaces directly with Legislative
-Yuan API endpoints, a stable internet connection is required. Users are
-welcome to contact [the author](https://davidycliao.github.io) for any
-API implementation assistance.
-
-`legisTaiwan`
-套件旨在簡化台灣立法院資料的即時存取,其設計理念來自於英國的
-TheyWorkForYou API。透過在 R 環境中提供直接連接立法院開放資料 API
-的便捷管道,本套件不僅致力於提升立法問責制和公共透明度,更為學術研究者提供了系統化分析立法數據的工具。研究人員可以輕鬆獲取並分析立法委員的表決紀錄、問政質詢、法案提案等資料,有助於量化研究和實證分析。由於套件需要直接與立法院
-API 介接,使用時請確保網路連線穩定。如有任何 API
-使用上的問題,歡迎與套件[作者](https://davidycliao.github.io)聯繫。
-
-
-
-
-
-
-
-### Get Started with Using [`remotes`](https://github.com/r-lib/remotes):
-
-``` r
-install.packages("remotes")
-remotes::install_github("davidycliao/legisTaiwan", force = TRUE)
-```
-
- library(legisTaiwan)
- #> ## legisTaiwan ##
- #> ## An R package connecting to the Taiwan Legislative API. ##
-
-### Summary Descriptive of Current Bills (法案提案統計)
-
-``` r
-get_variable_info("get_bills_2")
-#> $page_info
-#> # A tibble: 12 × 2
-#> `資料集名稱:議案提案` 資料集描述
-#>
-#> 1 資料目錄 "議事類"
-#> 2 資料集說明 "提供委員及政府之議案提案資訊。(自第8屆第1會期起)"
-#> 3 資料提供者 "議事暨公報資訊網"
-#> 4 欄位說明 "term:屆別,sessionPeriod:會期,sessionTimes:會次,meetingTime…
-#> 5 資料集預覽 "HTML預覽 6 資料集使用 "使用方式及列表"
-#> 7 API說明 "API提供參數分別為屆別(term)、會期(sessionPeriod)、會次(sessionTimes…
-#> 8 連結說明 "https://data.ly.gov.tw/odw/ID20Action.action?term=10…
-#> 9 更新頻率 "每日04時15分"
-#> 10 資料筆數 "30766"
-#> 11 建立時間 "2014-09-03WedSep0310:38:36CST2014"
-#> 12 更新時間 "2024-12-26ThuDec2604:21:02CST2024"
-#>
-#> $reference_url
-#> [1] "https://data.ly.gov.tw/getds.action?id=20"
-```
-
-### Summary Descriptive of Parliamentary Questions (委員質詢事項統計分析)
-
-``` r
-get_variable_info("get_parlquestions")
-#> $page_info
-#> # A tibble: 12 × 2
-#> `資料集名稱:質詢事項(本院委員質詢部分)` 資料集描述
-#>
-#> 1 資料目錄 "質詢類"
-#> 2 資料集說明 "提供議事日程本院委員之質詢事項資訊。(自第10屆第1會期起)"……
-#> 3 資料提供者 "議事暨公報資訊網"
-#> 4 欄位說明 "term:屆別,sessionPeriod:會期,sessionTi…
-#> 5 資料集預覽 "HTML預覽 6 資料集使用 "使用方式及列表"
-#> 7 API說明 "API提供參數分別為屆別(term)、會期(sessionPerio…
-#> 8 連結說明 "https://data.ly.gov.tw/odw/ID6Acti…
-#> 9 更新頻率 "每日01時55分"
-#> 10 資料筆數 "1689"
-#> 11 建立時間 "2014-08-18MonAug1806:00:00CST2014"
-#> 12 更新時間 "2024-12-27FriDec2701:56:46CST2024"
-#>
-#> $reference_url
-#> [1] "https://data.ly.gov.tw/getds.action?id=6"
-```
-
-
-
-### Notice:
-
-
-
-`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. Also, consider writing a batch retrieval process with
-appropriate handlers to track the progress of file input, ensuring the
-completeness of the requested data.
-
-
-
-### Acknowledgments
-
-
-
-This package supported the author’s doctoral dissertation *“Electoral
-Reform, Distributive Politics, and Parties in the Taiwanese Congress”*
-at the University of Essex. The PhD project was made possible through
-the generous funding of the 2022 Taiwan Ministry of Science and
-Technology (MOST) TOP Grant and a full PhD fellowship from the Ministry
-of Education (2018-2021), Taiwan. The author extends sincere gratitude
-to the Legislative Yuan API Center for their technical assistance and
-commitment to data transparency.
-
-
diff --git a/.Rproj.user/763C8F27/sources/session-ab45fd2f/8F65F2D7-contents b/.Rproj.user/763C8F27/sources/session-ab45fd2f/8F65F2D7-contents
deleted file mode 100644
index 4733aa71..00000000
--- a/.Rproj.user/763C8F27/sources/session-ab45fd2f/8F65F2D7-contents
+++ /dev/null
@@ -1,40 +0,0 @@
-Package: legisTaiwan
-Type: Package
-Title: An Interface to Access Taiwan Legislative API in R
-Version: 0.1.6
-Authors@R: c(person("David", "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")),
- person("Taiwan National Science and Technology Council", role = "ctb"),
- person("Taiwan Science & Technology Policy Research and Information Center NARLabs", role = "ctb"))
-Description: The pacakge is designed to make it quickly and easy to access Taiwan
- Legislative Yuan API for downloading real-time data legislative and
- historical archives.
-Maintainer: David Liao
-Depends: R (>= 3.4.0)
-License: GPL-3 + file LICENSE
-Encoding: UTF-8
-LazyData: true
-Imports:
- jsonlite,
- attempt,
- stringr,
- curl,
- tibble,
- rvest,
- withr,
- httr
-Suggests:
- knitr,
- rmarkdown,
- ggplot2,
- remotes,
- tidyverse,
- testthat (>= 3.0.0)
-RoxygenNote: 7.3.2
-BugReports: https://github.com/davidycliao/legisTaiwan/issues
-URL: https://davidycliao.github.io/legisTaiwan/
-VignetteBuilder: knitr
-Roxygen: list(markdown = TRUE)
-Config/testthat/edition: 3
-SystemRequirements: pandoc (>= 1.14) - http://pandoc.org
diff --git a/.Rproj.user/763C8F27/sources/session-ab45fd2f/8FE1B913-contents b/.Rproj.user/763C8F27/sources/session-ab45fd2f/8FE1B913-contents
deleted file mode 100644
index 93ff2f8d..00000000
--- a/.Rproj.user/763C8F27/sources/session-ab45fd2f/8FE1B913-contents
+++ /dev/null
@@ -1,993 +0,0 @@
-#' The Spoken Meeting Records 委員發言
-#'
-#'@author David Liao (davidycliao@@gmail.com)
-#'
-#'@param start_date numeric Must be formatted in Minguo (Taiwan) calendar, e.g. 1090101.
-#'
-#'@param end_date numeric Must be formatted in Minguo (Taiwan) calendar, e.g. 1090102.
-#'
-#'@param meeting_unit NULL The default is NULL, which includes all meeting types
-#' between the starting date and the ending date.
-#'
-#'@param verbose logical, indicates whether `get_meetings` should print out
-#'detailed output when retrieving the data.
-#'
-#'@return list, which contains: \describe{
-#' \item{`title`}{the spoken meeting records }
-#' \item{`query_time`}{the query time}
-#' \item{`retrieved_number`}{the number of the observation}
-#' \item{`meeting_unit`}{the meeting unit}
-#' \item{`start_date_ad`}{the start date in POSIXct}
-#' \item{`end_date_ad`}{the end date in POSIXct}
-#' \item{`start_date`}{the start date in ROC Taiwan calendar}
-#' \item{`url`}{the retrieved json url}
-#' \item{`variable_names`}{the variables of the tibble dataframe}
-#' \item{`manual_info`}{the offical manual, \url{https://www.ly.gov.tw/Pages/List.aspx?nodeid=154}; or use get_variable_info("get_meetings")}
-#' \item{`data`}{a tibble dataframe, whose variables include:
-#' \describe{\item{`smeeting_date`}{會議日期}
-#' \item{`meeting_status`}{會議狀態}
-#' \item{`meeting_name`}{會議名稱}
-#' \item{`meeting_content`}{會議事由}
-#' \item{`speechers`}{委員發言名單}
-#' \item{`meeting_unit`}{主辦單位}
-#' \item{`date_ad`}{西元年}
-#' }
-#' }
-#' }
-#'
-#'@import utils
-#'@importFrom attempt stop_if_all
-#'@importFrom jsonlite fromJSON
-#'@importFrom withr with_options
-#'
-#'@export
-#'
-#'@examples
-#' ## query meeting records by a period of the dates in Minguo (Taiwan) calendar
-#' ## 輸入「中華民國民年」下載「委員發言」
-#'get_meetings(start_date = "1050120", end_date = "1050210")
-#'
-#' ## query meeting records by a period of the dates in Minguo (Taiwan) calendar format
-#' ## and a meeting
-#' ## 輸入「中華民國民年」與「審查會議或委員會名稱」下載會議審查資訊
-#' get_meetings(start_date = 1060120, end_date = 1070310, meeting_unit = "內政委員會")
-#'
-#'@details `get_meetings` produces a list, which contains `title`, `query_time`,
-#'`retrieved_number`, `meeting_unit`, `start_date_ad`, `end_date_ad`, `start_date`,
-#'`end_date`, `url`, `variable_names`, `manual_info` and `data`.
-#'
-#'@note To retrieve the user manual and more information about variable of the data
-#'frame, please use `get_variable_info("get_meetings")` or visit
-#'the API manual at \url{https://www.ly.gov.tw/Pages/List.aspx?nodeid=154}.
-#'資料似乎不一致,待確認。委員發言(取得最早時間不詳,待檢查。)
-#'
-#'@seealso
-#'`get_variable_info("get_meetings")`
-#'
-#'@seealso
-#' Regarding Minguo calendar, please see \url{https://en.wikipedia.org/wiki/Republic_of_China_calendar}.
-
-# get_meetings <- function(start_date = NULL, end_date = NULL, meeting_unit = NULL,
-# verbose = TRUE) {
-# check_internet()
-# api_check(start_date = check_date(start_date), end_date = check_date(end_date))
-# set_api_url <- paste("https://www.ly.gov.tw/WebAPI/LegislativeSpeech.aspx?from=",
-# start_date, "&to=", end_date, "&meeting_unit=", meeting_unit, "&mode=json", sep = "")
-# tryCatch(
-# {
-# with_options(list(timeout = max(1000, getOption("timeout"))),{json_df <- jsonlite::fromJSON(set_api_url)})
-# df <- tibble::as_tibble(json_df)
-# attempt::stop_if_all(nrow(df) == 0, isTRUE, msg = "The query is unavailable.")
-# df["date_ad"] <- do.call("c", lapply(df$smeeting_date, transformed_date_meeting))
-# if (isTRUE(verbose)) {
-# cat(" Retrieved URL: \n", set_api_url, "\n")
-# cat(" Retrieved via :", meeting_unit, "\n")
-# cat(" Retrieved date between:", as.character(check_date(start_date)), "and", as.character(check_date(end_date)), "\n")
-# cat(" Retrieved number:", nrow(df), "\n")
-# }
-# list_data <- list("title" = "the spoken meeting records",
-# "query_time" = Sys.time(),
-# "retrieved_number" = nrow(df),
-# "meeting_unit" = meeting_unit,
-# "start_date_ad" = check_date(start_date),
-# "end_date_ad" = check_date(end_date),
-# "start_date" = start_date,
-# "end_date" = end_date,
-# "url" = set_api_url,
-# "variable_names" = colnames(df),
-# "manual_info" = "https://www.ly.gov.tw/Pages/List.aspx?nodeid=154",
-# "data" = df)
-# return(list_data)
-# },
-# error = function(error_message) {
-# message(error_message)
-# }
-# )
-# }
-get_meetings <- function(start_date = NULL, end_date = NULL, meeting_unit = NULL,
- verbose = TRUE) {
- check_internet()
-
- # 先檢查必要參數
- if(is.null(start_date) || is.null(end_date)) {
- message("\nBoth start_date and end_date must be provided.\n")
- }
-
- # 初始化進度顯示
- if(isTRUE(verbose)) {
- cat("\nInput Format Information:\n")
- cat("------------------------\n")
- cat("Date Format: YYYMMDD (ROC calendar)\n")
- cat("Example: 1090101 for 2020/01/01\n")
- cat("------------------------\n\n")
- cat("Downloading meeting records data...\n")
- pb <- txtProgressBar(min = 0, max = 100, style = 3)
- }
-
- # Update progress bar to 20%
- if(isTRUE(verbose)) setTxtProgressBar(pb, 20)
-
- api_check(start_date = check_date(start_date), end_date = check_date(end_date))
-
- # Update progress bar to 40%
- if(isTRUE(verbose)) setTxtProgressBar(pb, 40)
-
- set_api_url <- paste("https://www.ly.gov.tw/WebAPI/LegislativeSpeech.aspx?from=",
- start_date, "&to=", end_date,
- "&meeting_unit=", meeting_unit, "&mode=json", sep = "")
-
- tryCatch(
- {
- # Update progress bar to 60%
- if(isTRUE(verbose)) setTxtProgressBar(pb, 60)
-
- with_options(list(timeout = max(1000, getOption("timeout"))),{
- json_df <- jsonlite::fromJSON(set_api_url)
- })
-
- # Update progress bar to 80%
- if(isTRUE(verbose)) setTxtProgressBar(pb, 80)
-
- df <- tibble::as_tibble(json_df)
- attempt::stop_if_all(nrow(df) == 0, isTRUE, msg = "Query returned no data.")
- df["date_ad"] <- do.call("c", lapply(df$smeeting_date, transformed_date_meeting))
-
- # Update progress bar to 100% and show results
- if(isTRUE(verbose)) {
- setTxtProgressBar(pb, 100)
- close(pb)
- cat("\n\n")
- cat("====== Retrieved Information ======\n")
- cat("-----------------------------------\n")
- cat(" URL: \n", set_api_url, "\n")
- if(!is.null(meeting_unit)) {
- cat(" Meeting Unit: ", meeting_unit, "\n")
- }
- cat(" Date Range: ", as.character(check_date(start_date)),
- " to ", as.character(check_date(end_date)), "\n")
- cat(" Total Records: ", nrow(df), "\n")
-
- # Add meeting type distribution if available
- if("meeting_type" %in% colnames(df)) {
- meeting_counts <- table(df$meeting_type)
- cat("\nMeeting Type Distribution:\n")
- for(type in names(meeting_counts)) {
- cat(sprintf(" %s: %d\n", type, meeting_counts[type]))
- }
- }
- cat("===================================\n")
- }
-
- list_data <- list(
- "title" = "Meeting Records",
- "query_time" = Sys.time(),
- "retrieved_number" = nrow(df),
- "meeting_unit" = meeting_unit,
- "start_date_ad" = check_date(start_date),
- "end_date_ad" = check_date(end_date),
- "start_date" = start_date,
- "end_date" = end_date,
- "url" = set_api_url,
- "variable_names" = colnames(df),
- "manual_info" = "https://www.ly.gov.tw/Pages/List.aspx?nodeid=154",
- "data" = df
- )
- return(list_data)
- },
- error = function(error_message) {
- if(isTRUE(verbose)) {
- close(pb)
- cat("\nError occurred while fetching data:\n")
- cat(sprintf("Error: %s\n", error_message))
- }
- message(error_message)
- }
- )
-}
-
-
-#' The Meeting Records of Cross-caucus Session 黨團協商資訊
-#'
-#'@author David Liao (davidycliao@@gmail.com)
-#'
-#'@param start_date character Must be formatted in Minguo (ROC) calendar with three
-#'forward slashes between year, month and day, e.g. "106/10/20".
-#'
-#'@param end_date character Must be formatted in Minguo (ROC) calendar with three
-#'forward slashes between year, month and day, e.g. "109/01/10".
-#'
-#'@param verbose logical, indicates whether `get_caucus_meetings` should print out
-#'detailed output when retrieving the data.
-#'
-#'@return list, which contains: \describe{
-#' \item{`title`}{the meeting records of cross-caucus session}
-#' \item{`query_time`}{the query time}
-#' \item{`retrieved_number`}{the number of observation}
-#' \item{`meeting_unit`}{the meeting unit}
-#' \item{`start_date_ad`}{the start date in POSIXct}
-#' \item{`end_date_ad`}{the end date in POSIXct}
-#' \item{`start_date`}{the start date in ROC Taiwan calendar}
-#' \item{`url`}{the retrieved json url}
-#' \item{`variable_names`}{the variables of the tibble dataframe}
-#' \item{`manual_info`}{the official manual, \url{https://data.ly.gov.tw/getds.action?id=8}; or use get_variable_info("get_caucus_meetings")}
-#' \item{`data`}{a tibble dataframe, whose variables include:
-#' \describe{\item{`comYear`}{卷}
-#' \item{`comVolume`}{期}
-#' \item{`comBookId`}{冊別}
-#' \item{`term`}{屆別}
-#' \item{`sessionPeriod`}{會期}
-#' \item{`meetingTimes`}{臨時會會次}
-#' \item{`meetingDate`}{會議日期(民國年)}
-#' \item{`meetingName`}{會議名稱}
-#' \item{`subject`}{案由}
-#' \item{`pageStart`}{起始頁}
-#' \item{`pageEnd`}{結束頁}
-#' \item{`docUrl`}{檔案下載位置}
-#' \item{`htmlUrl`}{html網址}
-#' \item{`selectTerm`}{屆別期別篩選條件}
-#' }
-#' }
-#' }
-#'
-#'@import utils
-#'@importFrom attempt stop_if_all
-#'@importFrom jsonlite fromJSON
-#'@importFrom withr with_options
-#'
-#'@export
-#'@examples
-#' ## query the meeting records of cross-caucus session using a period of
-#' ## the dates in Taiwan ROC calender format with forward slash (/).
-#' ## 輸入「中華民國民年」下載「黨團協商」,輸入時間請依照該格式 "106/10/20",
-#' ## 需有「正斜線」做隔開。
-#'get_caucus_meetings(start_date = "106/10/20", end_date = "107/03/10")
-#'
-#'@details `get_caucus_meetings` produces a list, which contains `title`, `query_time`,
-#'`retrieved_number`, `meeting_unit`, `start_date_ad`, `end_date_ad`, `start_date`,
-#'`end_date`, `url`, `variable_names`, `manual_info` and `data.`
-#'
-#'@note To retrieve the user manual and more information about variable of the data
-#' frame, please use `get_variable_info("get_caucus_meetings")`
-#' or visit the API manual at \url{https://data.ly.gov.tw/getds.action?id=8}.
-#' 議事類:提供公報之黨團協商資訊 (自第8屆第1會期起)
-#'
-#'@seealso
-#'`get_variable_info("get_caucus_meetings")` Regarding Minguo calendar, please see \url{https://en.wikipedia.org/wiki/Republic_of_China_calendar}.
-get_caucus_meetings <- function(start_date = NULL, end_date = NULL,
- verbose = TRUE) {
- # 檢查日期格式
- date_format_check <- function(date) {
- if (!is.null(date) && !grepl("^\\d{3}/\\d{2}/\\d{2}$", date)) {
- stop(paste("Invalid date format:", date, "\n",
- "Please use the format 'YYY/MM/DD' (ROC calendar),\n",
- "For example: '106/10/20'\n",
- "Where YYY is the ROC year (民國年)"))
- }
- }
-
- check_internet()
- date_format_check(start_date)
- date_format_check(end_date)
-
- if(isTRUE(verbose)) {
- cat("Downloading caucus meetings data...\n")
- pb <- txtProgressBar(min = 0, max = 100, style = 3)
- }
-
- # Update progress bar to 20%
- if(isTRUE(verbose)) setTxtProgressBar(pb, 20)
-
- api_check(start_date = transformed_date_meeting(start_date),
- end_date = transformed_date_meeting(end_date))
-
- # Update progress bar to 40%
- if(isTRUE(verbose)) setTxtProgressBar(pb, 40)
-
- set_api_url <- paste("https://data.ly.gov.tw/odw/ID8Action.action?comYear=&comVolume=&comBookId=&term=&sessionPeriod=&sessionTimes=&meetingTimes=&meetingDateS=",
- start_date, "&meetingDateE=", end_date, "&fileType=json", sep = "")
-
- tryCatch(
- {
- # Update progress bar to 60%
- if(isTRUE(verbose)) setTxtProgressBar(pb, 60)
-
- with_options(list(timeout = max(1000, getOption("timeout"))),{
- json_df <- jsonlite::fromJSON(set_api_url)
- })
-
- # Update progress bar to 80%
- if(isTRUE(verbose)) setTxtProgressBar(pb, 80)
-
- df <- tibble::as_tibble(json_df$dataList)
- attempt::stop_if_all(nrow(df) == 0, isTRUE, msg = "The query is unavailable.")
-
- # Update progress bar to 100% and close it
- if(isTRUE(verbose)) {
- setTxtProgressBar(pb, 100)
- close(pb)
- cat("\n\n") # Add newlines after progress bar
- cat("====== Retrieved Information ======\n")
- cat("-----------------------------------\n")
- cat(" URL: \n", set_api_url, "\n")
- cat(" Date Range: ", as.character(transformed_date_meeting(start_date)),
- " to ", as.character(transformed_date_meeting(end_date)), "\n")
- cat(" Total Meetings: ", nrow(df), "\n")
- cat("===================================\n")
- }
-
- list_data <- list("title" = "the meeting records of cross-caucus session",
- "query_time" = Sys.time(),
- "retrieved_number" = nrow(df),
- "start_date_ad" = transformed_date_meeting(start_date),
- "end_date_ad" = transformed_date_meeting(end_date),
- "start_date" = start_date,
- "end_date" = end_date,
- "url" = set_api_url,
- "variable_names" = colnames(df),
- "manual_info" = "https://data.ly.gov.tw/getds.action?id=8",
- "data" = df)
- return(list_data)
- },
- error = function(error_message) {
- if(isTRUE(verbose)) {
- close(pb)
- cat("\n")
- }
- message(error_message)
- }
- )
-}
-
-
-#' Video Information of Legislative Meetings and Committees
-#'
-#' @title The Video Information of Meetings and Committees 院會及委員會之委員發言片段相關影片資訊
-#'
-#' @description
-#' Retrieves video records and information of legislative meetings and committee sessions,
-#' including speech segments, meeting details, and video URLs. Data is available in both
-#' JSON and CSV formats from the 9th legislative term onwards.
-#'
-#' @param term numeric or NULL. Legislative term number (e.g., 10).
-#' Data is available from the 9th term onwards. Default is NULL.
-#'
-#' @param session_period numeric or NULL. Session period number (1-8).
-#' Default is NULL.
-#'
-#' @param start_date character. Must be formatted in ROC calendar with forward slashes
-#' between year, month and day, e.g., "110/10/01".
-#'
-#' @param end_date character. Must be formatted in ROC calendar with forward slashes
-#' between year, month and day, e.g., "110/10/30".
-#'
-#' @param verbose logical. Whether to display download progress and detailed information.
-#' Default is TRUE.
-#'
-#' @param format character. Data format to retrieve, either "json" or "csv".
-#' Default is "json".
-#'
-#' @return A list containing:
-#' \describe{
-#' \item{`title`}{speech video records}
-#' \item{`query_time`}{query timestamp}
-#' \item{`retrieved_number`}{number of videos retrieved}
-#' \item{`term`}{queried legislative term}
-#' \item{`session_period`}{queried session period}
-#' \item{`start_date`}{start date in ROC calendar}
-#' \item{`end_date`}{end date in ROC calendar}
-#' \item{`format`}{data format ("json" or "csv")}
-#' \item{`url`}{retrieved API URL}
-#' \item{`variable_names`}{variables in the tibble dataframe}
-#' \item{`manual_info`}{official manual URL}
-#' \item{`data`}{a tibble dataframe containing:
-#' \describe{
-#' \item{`term`}{屆別}
-#' \item{`sessionPeriod`}{會期}
-#' \item{`meetingDate`}{會議日期(西元年)}
-#' \item{`meetingTime`}{會議時間}
-#' \item{`meetingTypeName`}{主辦單位}
-#' \item{`meetingName`}{會議名稱}
-#' \item{`meetingContent`}{會議事由}
-#' \item{`legislatorName`}{委員姓名}
-#' \item{`areaName`}{選區名稱}
-#' \item{`speechStartTime`}{委員發言時間起}
-#' \item{`speechEndTime`}{委員發言時間迄}
-#' \item{`speechRecordUrl`}{發言紀錄網址}
-#' \item{`videoLength`}{影片長度}
-#' \item{`videoUrl`}{影片網址}
-#' \item{`selectTerm`}{屆別期別篩選條件}
-#' }
-#' }
-#' }
-#'
-#' @importFrom attempt stop_if_all
-#' @importFrom jsonlite fromJSON
-#' @importFrom withr with_options
-#' @importFrom readr read_csv
-#'
-#' @export
-#'
-#' @examples
-#' \dontrun{
-#' # Query video information in JSON format
-#' videos <- get_speech_video(
-#' term = 10,
-#' session_period = 4,
-#' start_date = "110/10/01",
-#' end_date = "110/10/30"
-#' )
-#'
-#' # Query in CSV format
-#' videos_csv <- get_speech_video(
-#' term = 10,
-#' session_period = 4,
-#' start_date = "110/10/01",
-#' end_date = "110/10/30",
-#' format = "csv"
-#' )
-#'
-#' # Query without specifying term/session
-#' videos <- get_speech_video(
-#' start_date = "110/10/01",
-#' end_date = "110/10/30"
-#' )
-#' }
-#'
-#' @details
-#' The function retrieves video information from legislative meetings and committee
-#' sessions. Data is available from the 9th legislative term onwards (2016/民國105年).
-#' The date parameters must use the ROC calendar format with forward slashes.
-#' Data can be retrieved in either JSON or CSV format.
-#'
-#' @note
-#' For more details about the data variables and API information,
-#' use `get_variable_info("get_speech_video")` or visit:
-#' \url{https://data.ly.gov.tw/getds.action?id=148}
-#'
-#' 會議類:提供立法院院會及委員會之委員發言片段相關影片資訊 (自第9屆第1會期起)。
-#'
-#' @seealso
-#' * `get_variable_info("get_speech_video")`
-#' * Example API URL: \url{https://data.ly.gov.tw/odw/ID148Action.action?term=10&sessionPeriod=4&meetingDateS=110/10/01&meetingDateE=110/10/30&meetingTime=&legislatorName=&fileType=csv}
-get_speech_video <- function(term = NULL,
- session_period = NULL,
- start_date = NULL,
- end_date = NULL,
- verbose = TRUE,
- format = "json") {
- # Check internet connectivity
- check_internet()
-
- # Format validation
- format <- match.arg(format, c("json", "csv"))
-
- if(isTRUE(verbose)) {
- cat("\nInput Format Information:\n")
- cat("------------------------\n")
- cat("Term: Must be numeric (e.g., 8, 9, 10)\n")
- cat("Session Period: Must be numeric (1-8)\n")
- cat("Date Format: YYY/MM/DD (ROC calendar)\n")
- cat("Example: 110/10/01\n")
- cat("------------------------\n\n")
- cat("Downloading speech video data...\n")
- pb <- txtProgressBar(min = 0, max = 100, style = 3)
- }
-
- # Date validation
- if(is.null(start_date) || is.null(end_date)) {
- stop("Both start_date and end_date must be provided")
- }
-
- # Input data validation
- if(!is.null(term)) {
- term_str <- sprintf("%02d", as.numeric(term))
- } else {
- term_str <- ""
- }
-
- if(!is.null(session_period)) {
- session_str <- sprintf("%02d", as.numeric(session_period))
- } else {
- session_str <- ""
- }
-
- # Update progress bar to 20%
- if(isTRUE(verbose)) setTxtProgressBar(pb, 20)
-
- # Construct API URL
- set_api_url <- paste0("https://data.ly.gov.tw/odw/ID148Action.action?",
- "term=", term_str,
- "&sessionPeriod=", session_str,
- "&meetingDateS=", start_date,
- "&meetingDateE=", end_date,
- "&meetingTime=&legislatorName=&fileType=", format)
-
- # Update progress bar to 40%
- if(isTRUE(verbose)) setTxtProgressBar(pb, 40)
-
- tryCatch(
- {
- # Update progress bar to 60%
- if(isTRUE(verbose)) setTxtProgressBar(pb, 60)
-
- if(format == "json") {
- response <- try({
- json_df <- jsonlite::fromJSON(set_api_url)
- if(!is.null(json_df$dataList)) {
- df <- tibble::as_tibble(json_df$dataList)
- } else {
- df <- tibble::tibble()
- }
- }, silent = TRUE)
- } else {
- response <- try({
- df <- readr::read_csv(set_api_url, show_col_types = FALSE)
- }, silent = TRUE)
- }
-
- # Update progress bar to 80%
- if(isTRUE(verbose)) setTxtProgressBar(pb, 80)
-
- # Data validation
- if(nrow(df) == 0) {
- if(isTRUE(verbose)) {
- setTxtProgressBar(pb, 100)
- close(pb)
- cat("\n\n")
- cat("====== Query Result ======\n")
- cat("-------------------------\n")
- cat("No records found. Please check:\n")
- cat("1. Date format (YYY/MM/DD)\n")
- cat("2. Term and session period\n")
- cat("3. Data availability\n")
- cat("-------------------------\n")
- }
- return(NULL)
- }
-
- # Update progress bar to 100%
- if(isTRUE(verbose)) {
- setTxtProgressBar(pb, 100)
- close(pb)
- cat("\n\n")
- cat("====== Retrieved Information ======\n")
- cat("-----------------------------------\n")
- cat(" Retrieved URL: \n", set_api_url, "\n")
- cat(" Term: ", term_str, "\n")
- if(!is.null(session_period)) {
- cat(" Session Period: ", session_period, "\n")
- }
- cat(" Date Range: ", start_date, " to ", end_date, "\n")
- cat(" Total Videos: ", nrow(df), "\n")
- cat(" Format: ", toupper(format), "\n")
- cat("===================================\n")
- }
-
- # Return data
- list_data <- list(
- "title" = "speech video records",
- "query_time" = Sys.time(),
- "retrieved_number" = nrow(df),
- "term" = term_str,
- "session_period" = session_str,
- "start_date" = start_date,
- "end_date" = end_date,
- "format" = format,
- "url" = set_api_url,
- "variable_names" = colnames(df),
- "manual_info" = "https://data.ly.gov.tw/getds.action?id=148",
- "data" = df
- )
- return(list_data)
- },
- error = function(error_message) {
- if(isTRUE(verbose)) {
- close(pb)
- cat("\nError occurred:\n")
- cat(as.character(error_message), "\n")
- }
- return(NULL)
- }
- )
-}
-
-
-#' The Records of National Public Debates 國是論壇
-#'
-#' @param term numeric or NULL. The default is set to 10. Legislative term number
-#' (e.g., 10). Data is officially available from the 8th term onwards, but
-#' testing shows data starts from the 10th term.
-#'
-#' @param session_period numeric or NULL. Session period number (1-8). Default is NULL.
-#' Use `review_session_info()` to see available session periods in ROC calendar.
-#'
-#' @param verbose logical. Whether to display download progress and detailed information.
-#' Default is TRUE.
-#'
-#' @return A list containing:
-#' \describe{
-#' \item{`title`}{public debates records}
-#' \item{`query_time`}{query timestamp}
-#' \item{`retrieved_number`}{number of records retrieved}
-#' \item{`retrieved_term`}{queried legislative term}
-#' \item{`url`}{retrieved API URL}
-#' \item{`variable_names`}{variables in the tibble dataframe}
-#' \item{`manual_info`}{official manual URL or use get_variable_info("get_public_debates")}
-#' \item{`data`}{a tibble dataframe containing:
-#' \describe{
-#' \item{`term`}{屆別}
-#' \item{`sessionPeriod`}{會期}
-#' \item{`sessionTimes`}{會次}
-#' \item{`meetingTimes`}{臨時會會次}
-#' \item{`dateTimeDesc`}{日期時間說明}
-#' \item{`meetingRoom`}{會議地點}
-#' \item{`chairman`}{主持人}
-#' \item{`legislatorName`}{委員姓名}
-#' \item{`speakType`}{發言類型(paper:書面發言,speak:發言)}
-#' \item{`content`}{內容}
-#' \item{`selectTerm`}{屆別期別篩選條件}
-#' }
-#' }
-#' }
-#'
-#' @import utils
-#' @importFrom attempt stop_if_all
-#' @importFrom jsonlite fromJSON
-#' @importFrom withr with_options
-#'
-#' @export
-#'
-#' @examples
-#' # Query public debates for term 10, session period 2
-#' debates <- get_public_debates(term = 10, session_period = 2)
-#'
-#' # Query without specifying session period
-#' debates <- get_public_debates(term = 10)
-#'
-#' @details
-#' The function retrieves records from the National Public Debates (國是論壇),
-#' including both spoken and written opinions. While officially available from
-#' the 8th legislative term, testing indicates data is only available from
-#' the 10th term onwards.
-#'
-#' @note
-#' For more details about the data variables and API information,
-#' use `get_variable_info("get_public_debates")` or visit the API manual at
-#' \url{https://data.ly.gov.tw/getds.action?id=7}.
-#' 議事類: 提供公報之國是論壇資訊,並包含書面意見。
-#' 自第8屆第1會期起,但實測資料從第10屆。
-#'
-#' @seealso
-#' * `get_variable_info("get_public_debates")`
-#' * `review_session_info()`
-#' * For ROC calendar information: \url{https://en.wikipedia.org/wiki/Republic_of_China_calendar}
-get_public_debates <- function(term = NULL, session_period = NULL, verbose = TRUE) {
- check_internet()
-
- if(isTRUE(verbose)) {
- cat("\nInput Format Information:\n")
- cat("------------------------\n")
- cat("Term: Must be numeric (e.g., 8, 9, 10)\n")
- cat("Session Period: Must be numeric (1-8)\n")
- cat("------------------------\n\n")
- cat("Downloading public debates data...\n")
- pb <- txtProgressBar(min = 0, max = 100, style = 3)
- }
-
- # Update progress bar to 20%
- if(isTRUE(verbose)) setTxtProgressBar(pb, 20)
-
- if (is.null(term)) {
- set_api_url <- paste("https://data.ly.gov.tw/odw/ID7Action.action?term=",
- term, "&sessionPeriod=",
- "&sessionTimes=&meetingTimes=&legislatorName=&speakType=&fileType=json",
- sep = "")
- message(" term is not defined...\n You are now requesting full data from the API. Please make sure your connectivity is stable until its completion.\n")
- } else {
- attempt::stop_if_all(term, is.character, msg = "\nPlease use numeric format only.")
- if (length(term) == 1) {
- term <- sprintf("%02d", as.numeric(term))
- } else if (length(term) > 1) {
- if(isTRUE(verbose)) close(pb)
- term <- paste(sprintf("%02d", as.numeric(term)), collapse = "&")
- message("The API is unable to query multiple terms and the retrieved data might not be complete.")
- }
- }
-
- # Update progress bar to 40%
- if(isTRUE(verbose)) setTxtProgressBar(pb, 40)
-
- set_api_url <- paste("https://data.ly.gov.tw/odw/ID7Action.action?term=",
- term, "&sessionPeriod=",
- sprintf("%02d", as.numeric(session_period)),
- "&sessionTimes=&meetingTimes=&legislatorName=&speakType=&fileType=json",
- sep = "")
-
- tryCatch(
- {
- # Update progress bar to 60%
- if(isTRUE(verbose)) setTxtProgressBar(pb, 60)
-
- with_options(list(timeout = max(1000, getOption("timeout"))),{
- json_df <- jsonlite::fromJSON(set_api_url)
- })
-
- # Update progress bar to 80%
- if(isTRUE(verbose)) setTxtProgressBar(pb, 80)
-
- df <- tibble::as_tibble(json_df$dataList)
- attempt::stop_if_all(nrow(df) == 0, isTRUE, msg = "The query is unavailable.")
-
- # Update progress bar to 100%
- if(isTRUE(verbose)) {
- setTxtProgressBar(pb, 100)
- close(pb)
- cat("\n\n") # Add newlines after progress bar
- cat("====== Retrieved Information ======\n")
- cat("-----------------------------------\n")
- cat(" Retrieved URL: \n", set_api_url, "\n")
- cat(" Term: ", term, "\n")
- if(!is.null(session_period)) {
- cat(" Session Period: ", session_period, "\n")
- }
- cat(" Total Records: ", nrow(df), "\n")
- if("legislatorName" %in% colnames(df)) {
- unique_legislators <- length(unique(df$legislatorName))
- cat(" Unique Legislators: ", unique_legislators, "\n")
- }
- cat("===================================\n")
- }
-
- list_data <- list(
- "title" = "public debates records",
- "query_time" = Sys.time(),
- "retrieved_number" = nrow(df),
- "retrieved_term" = term,
- "url" = set_api_url,
- "variable_names" = colnames(df),
- "manual_info" = "https://data.ly.gov.tw/getds.action?id=7",
- "data" = df
- )
- return(list_data)
- },
- error = function(error_message) {
- if(isTRUE(verbose)) {
- close(pb)
- cat("\n")
- }
- message(error_message)
- }
- )
-}
-
-#' The Records of Reviewed Items in the Committees 委員會會議審查之議案項目
-#'
-#'@author David Yen-Chieh Liao
-#'
-#'@param term numeric or null. Data is available only from the 8th term.
-#'The default is set to 10. 參數必須為數值。提供委員會會議審查之議案項目。(自第10屆第1會期起)
-#'
-#'@param session_period integer, numeric or NULL.
-#'`review_session_info()` provides each session period's available options based on the
-#' Minguo (Taiwan) calendar.
-#'
-#'@param verbose logical. This indicates whether `get_executive_response` should
-#'print a detailed output during data retrieval. Default is TRUE.
-#'
-#'@return A list containing:
-#' \item{`title`}{Records of questions answered by executives}
-#' \item{`query_time`}{Time of query}
-#' \item{`retrieved_number`}{Total number of observations}
-#' \item{`retrieved_term`}{Queried term}
-#' \item{`url`}{Retrieved JSON URL}
-#' \item{`variable_names`}{Variables of the tibble dataframe}
-#' \item{`manual_info`}{Official manual, \url{https://data.ly.gov.tw/getds.action?id=46}; or use get_variable_info("get_committee_record")}
-#' \item{`data`}{A tibble dataframe with variables:
-#' \describe{
-#' \item{`term`}{Term number}
-#' \item{`sessionPeriod`}{Session}
-#' \item{`meetingNo`}{Meeting number}
-#' \item{`billNo`}{Bill number}
-#' \item{`selectTerm`}{Term selection filter}
-#' }
-#' }
-#'
-#'@importFrom attempt stop_if_all
-#'@importFrom jsonlite fromJSON
-#'@importFrom withr with_options
-#'
-#'@export
-#'
-#'@examples
-#' ## Query the committee record by term and session period.
-#' ## 輸入「立委屆期」與「會期」下載「委員會審議之議案」
-#'get_committee_record(term = 10, session_period = 1)
-#'
-#'@details `get_committee_record` provides a list which includes `title`,
-#'`query_time`, `retrieved_number`, `retrieved_term`, `url`, `variable_names`,
-#' `manual_info`, and `data`.
-#'
-#'@note
-#' To access the user manual and more information about the data frame's variables,
-#' please refer to `get_variable_info("get_committee_record")` or check the API manual at
-#' \url{https://data.ly.gov.tw/getds.action?id=46}.
-#' This provides agenda items reviewed in committee meetings (from the 10th term, 1st session onwards).
-#'
-#'@seealso
-#'`get_variable_info("get_committee_record")`, `review_session_info()`
-#' The Records of Reviewed Items in the Committees 委員會會議審查之議案項目
-#'
-#'@author David Yen-Chieh Liao
-#'
-#'@param term numeric or null. Data is available only from the 8th term.
-#'The default is set to 10. 參數必須為數值。提供委員會會議審查之議案項目。(自第10屆第1會期起)
-#'
-#'@param session_period integer, numeric or NULL.
-#'`review_session_info()` provides each session period's available options based on the
-#' Minguo (Taiwan) calendar.
-#'
-#'@param verbose logical. This indicates whether `get_executive_response` should
-#'print a detailed output during data retrieval. Default is TRUE.
-#'
-#'@return A list containing:
-#' \item{`title`}{Records of questions answered by executives}
-#' \item{`query_time`}{Time of query}
-#' \item{`retrieved_number`}{Total number of observations}
-#' \item{`retrieved_term`}{Queried term}
-#' \item{`url`}{Retrieved JSON URL}
-#' \item{`variable_names`}{Variables of the tibble dataframe}
-#' \item{`manual_info`}{Official manual, \url{https://data.ly.gov.tw/getds.action?id=46}; or use get_variable_info("get_committee_record")}
-#' \item{`data`}{A tibble dataframe with variables:
-#' \describe{
-#' \item{`term`}{Term number}
-#' \item{`sessionPeriod`}{Session}
-#' \item{`meetingNo`}{Meeting number}
-#' \item{`billNo`}{Bill number}
-#' \item{`selectTerm`}{Term selection filter}
-#' }
-#' }
-#'
-#'@import utils
-#'@importFrom attempt stop_if_all
-#'@importFrom jsonlite fromJSON
-#'@importFrom withr with_options
-#'
-#'@export
-#'
-#'@examples
-#' ## Query the committee record by term and session period.
-#' ## 輸入「立委屆期」與「會期」下載「委員會審議之議案」
-#'get_committee_record(term = 10, session_period = 1)
-#'
-#'@details `get_committee_record` provides a list which includes `title`,
-#'`query_time`, `retrieved_number`, `retrieved_term`, `url`, `variable_names`,
-#' `manual_info`, and `data`.
-#'
-#'@note
-#' To access the user manual and more information about the data frame's variables,
-#' please refer to `get_variable_info("get_committee_record")` or check the API manual at
-#' \url{https://data.ly.gov.tw/getds.action?id=46}.
-#' This provides agenda items reviewed in committee meetings (from the 10th term, 1st session onwards).
-#'
-#'@seealso
-#'`get_variable_info("get_committee_record")`, `review_session_info()`
-get_committee_record <- function(term = 10, session_period = NULL, verbose = TRUE) {
- check_internet()
-
- if(isTRUE(verbose)) {
- cat("\nInput Format Information:\n")
- cat("------------------------\n")
- cat("Term: Must be numeric (e.g., 8, 9, 10)\n")
- cat("Session Period: Must be numeric (1-8)\n")
- cat("------------------------\n\n")
- cat("Downloading committee records data...\n")
- pb <- txtProgressBar(min = 0, max = 100, style = 3)
- }
-
- # Update progress bar to 20%
- if(isTRUE(verbose)) setTxtProgressBar(pb, 20)
-
- if (is.null(term)) {
- set_api_url <- paste("https://data.ly.gov.tw/odw/ID46Action.action?term=",
- term, "&sessionPeriod=",
- "&sessionTimes=01&meetingTimes=&fileType=json", sep = "")
- message(" term is not defined...\n You are now requesting full data from the API. Please make sure your connectivity is stable until its completion.\n")
- } else {
- attempt::stop_if_all(term, is.character, msg = "use numeric format only.")
- if (length(term) == 1) {
- term <- sprintf("%02d", as.numeric(term))
- } else if (length(term) > 1) {
- if(isTRUE(verbose)) close(pb)
- term <- paste(sprintf("%02d", as.numeric(term)), collapse = "&")
- message("The API is unable to query multiple terms and the retrieved data might not be complete.")
- }
- }
-
- # Update progress bar to 40%
- if(isTRUE(verbose)) setTxtProgressBar(pb, 40)
-
- set_api_url <- paste("https://data.ly.gov.tw/odw/ID46Action.action?term=",
- term,
- "&sessionPeriod=", sprintf("%02d", as.numeric(session_period)),
- "&sessionTimes=01&meetingTimes=&fileType=json", sep = "")
-
- tryCatch(
- {
- # Update progress bar to 60%
- if(isTRUE(verbose)) setTxtProgressBar(pb, 60)
-
- with_options(list(timeout = max(1000, getOption("timeout"))),{
- json_df <- jsonlite::fromJSON(set_api_url)
- })
-
- # Update progress bar to 80%
- if(isTRUE(verbose)) setTxtProgressBar(pb, 80)
-
- df <- tibble::as_tibble(json_df$dataList)
- attempt::stop_if_all(nrow(df) == 0, isTRUE, msg = "The query is unavailable.")
-
- # Update progress bar to 100%
- if(isTRUE(verbose)) {
- setTxtProgressBar(pb, 100)
- close(pb)
- cat("\n\n") # Add newlines after progress bar
- cat("====== Retrieved Information ======\n")
- cat("-----------------------------------\n")
- cat(" Retrieved URL: \n", set_api_url, "\n")
- cat(" Term: ", term, "\n")
- if(!is.null(session_period)) {
- cat(" Session Period: ", session_period, "\n")
- }
- cat(" Total Records: ", nrow(df), "\n")
-
- if("committee" %in% colnames(df)) {
- committee_counts <- table(df$committee)
- cat("\nCommittee Distribution:\n")
- for(comm in names(committee_counts)) {
- cat(sprintf(" %s: %d\n", comm, committee_counts[comm]))
- }
- }
- cat("===================================\n")
- }
-
- list_data <- list(
- "title" = "the records of reviewed items in the committees",
- "query_time" = Sys.time(),
- "retrieved_number" = nrow(df),
- "retrieved_term" = term,
- "url" = set_api_url,
- "variable_names" = colnames(df),
- "manual_info" = "https://data.ly.gov.tw/getds.action?id=46",
- "data" = df
- )
- return(list_data)
- },
- error = function(error_message) {
- if(isTRUE(verbose)) {
- close(pb)
- cat("\n")
- }
- message(error_message)
- }
- )
-}
diff --git a/.Rproj.user/763C8F27/sources/session-ab45fd2f/94CF26B1-contents b/.Rproj.user/763C8F27/sources/session-ab45fd2f/94CF26B1-contents
deleted file mode 100644
index 0ee615ff..00000000
--- a/.Rproj.user/763C8F27/sources/session-ab45fd2f/94CF26B1-contents
+++ /dev/null
@@ -1,9 +0,0 @@
-.Rproj.user
-.Rhistory
-.RData
-.Ruserdata
-.Rmd
-docs
-inst/doc
-/doc/
-/Meta/
diff --git a/.Rproj.user/763C8F27/sources/session-ab45fd2f/951C614C-contents b/.Rproj.user/763C8F27/sources/session-ab45fd2f/951C614C-contents
deleted file mode 100644
index 2fee0978..00000000
--- a/.Rproj.user/763C8F27/sources/session-ab45fd2f/951C614C-contents
+++ /dev/null
@@ -1,340 +0,0 @@
-#' The Records of Parliamentary Questions 委員質詢事項資訊
-#'
-#' @author David Liao (davidycliao@@gmail.com)
-#'
-#' @param term numeric or NULL. The default is set to NULL. 參數必須為數值。
-#'
-#' @param session_period integer, numeric or NULL. Available
-#' options for the session is: 1, 2, 3, 4, 5, 6, 7, and 8. The default is set to 8 參數必須為數值。
-#' `review_session_info()` generates each session period available option period
-#' in Minguo (Taiwan) calendar.
-#'
-#' @param verbose logical, indicates whether `get_parlquestions` should print out
-#' detailed output when retrieving the data. The default is TRUE.
-#'
-#' @return A list containing:
-#' \describe{
-#' \item{`title`}{the records of parliamentary questions}
-#' \item{`query_time`}{the queried time}
-#' \item{`retrieved_number`}{the total number of observations}
-#' \item{`retrieved_term`}{the queried term}
-#' \item{`url`}{the retrieved json url}
-#' \item{`variable_names`}{the variables of the tibble dataframe}
-#' \item{`manual_info`}{the offical manual from \url{https://data.ly.gov.tw/getds.action?id=6}, or use get_variable_info("get_parlquestions")}
-#' \item{`data`}{a tibble dataframe, whose variables include:
-#' \describe{
-#' \item{`term`}{屆別}
-#' \item{`sessionPeriod`}{會期}
-#' \item{`sessionTimes`}{會次}
-#' \item{`item`}{項目}
-#' \item{`selectTerm`}{屆別期別篩選條件}
-#' }
-#' }
-#' }
-#'
-#' @importFrom attempt stop_if_all
-#' @importFrom jsonlite fromJSON
-#' @importFrom withr with_options
-#' @export
-#'
-#' @examples
-#' ## Query parliamentary questions by term.
-#' ## 輸入「立委會期」下載立委質詢資料
-#' get_parlquestions(term = 10)
-#'
-#' ## Query parliamentary questions by term and session period.
-#' ## 輸入「立委屆期」與「會期」下載立委質詢資料
-#' get_parlquestions(term = 10, session_period = 2)
-#'
-#' @details `get_parlquestions` produces a list, which contains `title`,
-#' `query_time`, `retrieved_number`, `retrieved_term`, `url`, `variable_names`,
-#' `manual_info`, and `data`.
-#'
-#' @note To retrieve the user manual and more information about variable of the data
-#' frame, please use `get_variable_info("get_parlquestions")`
-#' or visit the API manual at \url{https://data.ly.gov.tw/getds.action?id=6}.
-#' 質詢類: 提供議事日程本院委員之質詢事項資訊(自第8屆第1會期起)。
-#'
-#' @seealso `get_variable_info("get_parlquestions")`
-get_parlquestions <- function(term = NULL, session_period = NULL, verbose = TRUE) {
- check_internet()
-
- # 先檢查 term 並顯示訊息
- if (is.null(term)) {
- message("\nTerm is not defined...\nRequesting full data from the API. Please ensure stable connectivity.\n")
- }
-
- # 初始化進度顯示
- if(isTRUE(verbose)) {
- cat("\nInput Format Information:\n")
- cat("------------------------\n")
- cat("Term: Must be numeric (e.g., 8, 9, 10)\n")
- cat("Session Period: Must be numeric (1-8)\n")
- cat("------------------------\n\n")
- cat("Downloading parliamentary questions data...\n")
- pb <- txtProgressBar(min = 0, max = 100, style = 3)
- }
-
- # Update progress bar to 20%
- if(isTRUE(verbose)) setTxtProgressBar(pb, 20)
-
- # 建構 API URL
- if (is.null(term)) {
- set_api_url <- paste("https://data.ly.gov.tw/odw/ID6Action.action?term=", term,
- "&sessionPeriod=",
- "&sessionTimes=&item=&fileType=json", sep = "")
- } else {
- attempt::stop_if_all(term, is.character, msg = "Please use numeric format only.")
- if (length(term) == 1) {
- term <- sprintf("%02d", as.numeric(term))
- } else if (length(term) > 1) {
- if(isTRUE(verbose)) close(pb)
- term <- paste(sprintf("%02d", as.numeric(term)), collapse = "&")
- stop("API does not support multiple terms.")
- }
- }
-
- # Update progress bar to 40%
- if(isTRUE(verbose)) setTxtProgressBar(pb, 40)
-
- set_api_url <- paste("https://data.ly.gov.tw/odw/ID6Action.action?term=", term,
- "&sessionPeriod=",
- sprintf("%02d", as.numeric(session_period)),
- "&sessionTimes=&item=&fileType=json", sep = "")
-
- tryCatch(
- {
- # Update progress bar to 60%
- if(isTRUE(verbose)) setTxtProgressBar(pb, 60)
-
- with_options(list(timeout = max(1000, getOption("timeout"))),{
- json_df <- jsonlite::fromJSON(set_api_url)
- })
-
- # Update progress bar to 80%
- if(isTRUE(verbose)) setTxtProgressBar(pb, 80)
-
- df <- tibble::as_tibble(json_df$dataList)
- attempt::stop_if_all(nrow(df) == 0, isTRUE, msg = "Query returned no data.")
-
- # Update progress bar to 100% and show results
- if(isTRUE(verbose)) {
- setTxtProgressBar(pb, 100)
- close(pb)
- cat("\n\n")
- cat("====== Retrieved Information ======\n")
- cat("-----------------------------------\n")
- cat(" URL: \n", set_api_url, "\n")
- cat(" Term: ", term, "\n")
- if(!is.null(session_period)) {
- cat(" Session Period: ", session_period, "\n")
- }
- cat(" Total Questions: ", nrow(df), "\n")
-
- # Add session period distribution if available
- if("sessionPeriod" %in% colnames(df)) {
- session_counts <- table(df$sessionPeriod)
- cat("\nSession Distribution:\n")
- for(session in names(session_counts)) {
- cat(sprintf(" Session %s: %d\n", session, session_counts[session]))
- }
- }
- cat("===================================\n")
- }
-
- # 回傳結果
- list_data <- list(
- "title" = "Parliamentary Questions Records",
- "query_time" = Sys.time(),
- "retrieved_number" = nrow(df),
- "retrieved_term" = term,
- "url" = set_api_url,
- "variable_names" = colnames(df),
- "manual_info" = "https://data.ly.gov.tw/getds.action?id=6",
- "data" = df
- )
- return(list_data)
- },
- error = function(error_message) {
- if(isTRUE(verbose)) {
- close(pb)
- cat("\nError occurred while fetching data:\n")
- cat(sprintf("Error: %s\n", error_message))
- }
- message(error_message)
- }
- )
-}
-
-#'The Records of Response to the Questions by the Executives 公報質詢事項行政院答復資訊
-#'
-#'@author David Liao (davidycliao@@gmail.com)
-#'
-#'@param term integer, numeric or NULL. The default is NULL. The data is only
-#'available from 8th term. 參數必須為數值。資料從自第8屆起,預設值為8。
-#'
-#'@param session_period integer, numeric or NULL. Available
-#'options for the session is: 1, 2, 3, 4, 5, 6, 7, and 8. The default is set to NULL. 參數必須為數值。
-#'`review_session_info()` generates each session period available option period
-#' in Minguo (Taiwan) calendar.
-#'
-#'@param verbose logical, indicates whether `get_executive_response` should
-#'print out detailed output when retrieving the data. The default is set to TRUE
-#'
-#'@return list contains: \describe{
-#' \item{`title`}{the records of the questions answered by the executives}
-#' \item{`query_time`}{the queried time}
-#' \item{`retrieved_number`}{the total number of observations}
-#' \item{`retrieved_term`}{the queried term}
-#' \item{`url`}{the retrieved json url}
-#' \item{`variable_names`}{the variables of the tibble dataframe}
-#' \item{`manual_info`}{the offical manual}
-#' \item{`data`}{a tibble dataframe, whose variables include:
-#' \describe{\item{`term`}{屆別}
-#' \item{`sessionPeriod`}{會期}
-#' \item{`sessionTimes`}{會次}
-#' \item{`meetingTimes`}{臨時會會次}
-#' \item{`eyNumber`}{行政院函公文編號}
-#' \item{`lyNumber`}{立法院函編號}
-#' \item{`subject`}{案由}
-#' \item{`content`}{內容}
-#' \item{`docUrl`}{案由}
-#' \item{`item`}{檔案下載位置}
-#' \item{`item`}{檔案下載位置}
-#' \item{`selectTerm`}{屆別期別篩選條件}
-#' }
-#' }
-#' }
-#'
-#'@importFrom attempt stop_if_all
-#'@importFrom jsonlite fromJSON
-#'@importFrom withr with_options
-#'@export
-#'
-#'@examples
-#' ## query the Executives' answered response by term and the session period.
-#' ## 輸入「立委屆期」與「會期」下載「行政院答復」
-#' get_executive_response(term = 8, session_period = 1)
-#'
-#'@details **`get_executive_response`** produces a list, which contains `title`,
-#'`query_time`, `retrieved_number`, `retrieved_term`, `url`, `variable_names`,
-#' `manual_info` and `data`. To retrieve the user manual and more information, please
-#' use `get_variable_info("get_executive_response")`.
-#'
-#'
-#'#'@note To retrieve the user manual and more information about variable of the data
-#' frame, please use `get_variable_info("get_executive_response")`
-#' or visit the API manual at \url{https://data.ly.gov.tw/getds.action?id=2}.
-#' 質詢類: 提供公報質詢事項行政院答復資訊 (自第8屆第1會期起)。
-#'
-#'@seealso
-#'`get_variable_info("get_executive_response")`, `review_session_info()`
-get_executive_response <- function(term = NULL, session_period = NULL, verbose = TRUE) {
- check_internet()
-
- # 先檢查 term 並顯示訊息
- if (is.null(term)) {
- message("\nTerm is not defined...\nRequesting full data from the API. Please ensure stable connectivity.\n")
- }
-
- # 初始化進度顯示
- if(isTRUE(verbose)) {
- cat("\nInput Format Information:\n")
- cat("------------------------\n")
- cat("Term: Must be numeric (e.g., 8, 9, 10, 11)\n")
- cat("Session Period: Must be numeric (1-8)\n")
- cat("------------------------\n\n")
- cat("Downloading executive response data...\n")
- pb <- txtProgressBar(min = 0, max = 100, style = 3)
- }
-
- # Update progress bar to 20%
- if(isTRUE(verbose)) setTxtProgressBar(pb, 20)
-
- # 建構 API URL
- if (is.null(term)) {
- set_api_url <- paste("https://data.ly.gov.tw/odw/ID2Action.action?term=",
- term, "&sessionPeriod=",
- "&sessionTimes=&item=&fileType=json", sep = "")
- } else {
- attempt::stop_if_all(term, is.character, msg = "\nPlease use numeric format only.")
- if (length(term) == 1) {
- term <- sprintf("%02d", as.numeric(term))
- } else if (length(term) > 1) {
- if(isTRUE(verbose)) close(pb)
- term <- paste(sprintf("%02d", as.numeric(term)), collapse = "&")
- stop("API does not support multiple terms.")
- }
- }
-
- # Update progress bar to 40%
- if(isTRUE(verbose)) setTxtProgressBar(pb, 40)
-
- set_api_url <- paste("https://data.ly.gov.tw/odw/ID2Action.action?term=",
- term, "&sessionPeriod=",
- sprintf("%02d", as.numeric(session_period)),
- "&sessionTimes=&item=&fileType=json", sep = "")
-
- tryCatch(
- {
- # Update progress bar to 60%
- if(isTRUE(verbose)) setTxtProgressBar(pb, 60)
-
- with_options(list(timeout = max(1000, getOption("timeout"))),{
- json_df <- jsonlite::fromJSON(set_api_url)
- })
-
- # Update progress bar to 80%
- if(isTRUE(verbose)) setTxtProgressBar(pb, 80)
-
- df <- tibble::as_tibble(json_df$dataList)
- attempt::stop_if_all(nrow(df) == 0, isTRUE, msg = "Query returned no data.")
-
- # Update progress bar to 100% and show results
- if(isTRUE(verbose)) {
- setTxtProgressBar(pb, 100)
- close(pb)
- cat("\n\n")
- cat("====== Retrieved Information ======\n")
- cat("-----------------------------------\n")
- cat(" URL: \n", set_api_url, "\n")
- cat(" Term: ", term, "\n")
- if(!is.null(session_period)) {
- cat(" Session Period: ", session_period, "\n")
- }
- cat(" Total Responses: ", nrow(df), "\n")
-
- # Add session period distribution if available
- if("sessionPeriod" %in% colnames(df)) {
- session_counts <- table(df$sessionPeriod)
- cat("\nSession Distribution:\n")
- for(session in names(session_counts)) {
- cat(sprintf(" Session %s: %d\n", session, session_counts[session]))
- }
- }
- cat("===================================\n")
- }
-
- # 回傳結果
- list_data <- list(
- "title" = "Executive Response Records",
- "query_time" = Sys.time(),
- "retrieved_number" = nrow(df),
- "retrieved_term" = term,
- "url" = set_api_url,
- "variable_names" = colnames(df),
- "manual_info" = "https://data.ly.gov.tw/getds.action?id=2",
- "data" = df
- )
- return(list_data)
- },
- error = function(error_message) {
- if(isTRUE(verbose)) {
- close(pb)
- cat("\nError occurred while fetching data:\n")
- cat(sprintf("Error: %s\n", error_message))
- }
- message(error_message)
- }
- )
-}
diff --git a/.Rproj.user/763C8F27/sources/session-ab45fd2f/97603842-contents b/.Rproj.user/763C8F27/sources/session-ab45fd2f/97603842-contents
deleted file mode 100644
index 62cad3fd..00000000
--- a/.Rproj.user/763C8F27/sources/session-ab45fd2f/97603842-contents
+++ /dev/null
@@ -1,66 +0,0 @@
----
-title: "An Example of Party Caucus Negotiation"
-output: rmarkdown::html_vignette
-vignette: >
- %\VignetteIndexEntry{An Example of Party Caucus Negotiation}
- %\VignetteEngine{knitr::rmarkdown}
- %\VignetteEncoding{UTF-8}
----
-
-```{r, include = FALSE}
-knitr::opts_chunk$set(
- collapse = TRUE,
- comment = "#>"
-)
-```
-
-```{r include=FALSE}
-assign("has_internet_via_proxy", TRUE, environment(curl::has_internet))
-```
-
-
-## Fetching Caucus Meeting Data
-First, load the package:
-
-
-```{r}
-library(legisTaiwan)
-```
-
-Now, let's retrieve caucus meeting records. Note the special date format required:
-
-
-```{r}
-caucus_df <- get_caucus_meetings(
- start_date = "111/09/23",
- end_date = "112/01/19",
- verbose = FALSE
-)
-```
-
-Important notes about date formatting:
-
-- Dates must be in ROC calendar format
-- Format required: "YYY/MM/DD" (with slashes)
-- This differs from the format used in get_bills()
-- Format standardization is planned for version 0.2+
-
-View the retrieved data:
-```{r}
-caucus_df$data
-```
-
-The returned data includes comprehensive information about caucus meetings, such as:
-
-- Meeting dates and times
-- Participating party caucuses
-- Meeting agendas and topics
-- Attendance records
-- Meeting outcomes and decisions
-
-The `docUrl` field provides direct access to the original caucus meeting minutes and documentation. This URL links to the official Legislative Yuan's repository where researchers and the public can view detailed records of caucus deliberations.
-
-```{r}
-caucus_df$data[c("subject", "docUrl")]
-```
-
diff --git a/.Rproj.user/763C8F27/sources/session-ab45fd2f/98215D9E-contents b/.Rproj.user/763C8F27/sources/session-ab45fd2f/98215D9E-contents
deleted file mode 100644
index 3b431f42..00000000
--- a/.Rproj.user/763C8F27/sources/session-ab45fd2f/98215D9E-contents
+++ /dev/null
@@ -1,153 +0,0 @@
----
-title: "Fetching Parliarmentary Questions"
-author: ""
-output: rmarkdown::html_vignette
-vignette: >
- %\VignetteIndexEntry{Fetching Parliarmentary Questions}
- %\VignetteEngine{knitr::rmarkdown}
- %\VignetteEncoding{UTF-8}
----
-
-```{r, include = FALSE}
-knitr::opts_chunk$set(
- collapse = TRUE,
- comment = "#>"
-)
-```
-
-
-```{r include=FALSE}
-assign("has_internet_via_proxy", TRUE, environment(curl::has_internet))
-```
-
-## Accessing Parliamentary Questions with legisTaiwan Package
-
-
-This tutorial demonstrates how to use the legisTaiwan package to access parliamentary questions and executive responses from Taiwan's Legislative Yuan. The package provides convenient functions to fetch publicly available data.
-
-
-
-### Loading the Package
-First, install and load the legisTaiwan package:
-```{r}
-library(legisTaiwan)
-```
-
-### Fetching Parliamentary Questions
-
-
-
-Use the get_parlquestions() function to retrieve parliamentary questions from legislators:
-
-
-
-```{r}
-# Fetch questions from the 11th term
-pa_term10 <- get_parlquestions(term = 11, verbose = TRUE)
-
-# Examine the data structure
-str(pa_term10)
-```
-
-__Function parameters:__
-
-- `term`: Legislative term (must be numeric, e.g., 11)
-- `session_period`: Session period (optional)
-- `verbose = TRUE`: Display download progress and information
-
-__The returned data contains:__
-
-- `title`: Data title
-- `query_time`: Query timestamp
-`_retrieved_number`: Number of records retrieved
-- `data`: A dataframe containing:
- + term: Legislative term
- + sessionPeriod: Session period
- + sessionTimes: Session count
- + item: Question items
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-### Retrieving Executive Responses
-Use the get_executive_response() function to fetch responses from the Executive Yuan:
-
-```{r}
-# Fetch executive responses from the 10th term, 2nd session
-exec_response <- get_executive_response(term = 10, session_period = 2, verbose = TRUE)
-
-# Examine the data structure
-head(exec_response$data)
-```
-
-__Function parameters:__
-
-- `term`: Legislative term
-- `session_period`: Session period
-- `verbose = TRUE`: Display download progress and information
-
-__The returned data includes:__
-
-- `title`: Data title
-- `query_time`: Query timestamp
-- `retrieved_number`: Number of records retrieved
-- `data`: A dataframe containing response information
diff --git a/.Rproj.user/763C8F27/sources/session-ab45fd2f/9DA711D8-contents b/.Rproj.user/763C8F27/sources/session-ab45fd2f/9DA711D8-contents
deleted file mode 100644
index 62cad3fd..00000000
--- a/.Rproj.user/763C8F27/sources/session-ab45fd2f/9DA711D8-contents
+++ /dev/null
@@ -1,66 +0,0 @@
----
-title: "An Example of Party Caucus Negotiation"
-output: rmarkdown::html_vignette
-vignette: >
- %\VignetteIndexEntry{An Example of Party Caucus Negotiation}
- %\VignetteEngine{knitr::rmarkdown}
- %\VignetteEncoding{UTF-8}
----
-
-```{r, include = FALSE}
-knitr::opts_chunk$set(
- collapse = TRUE,
- comment = "#>"
-)
-```
-
-```{r include=FALSE}
-assign("has_internet_via_proxy", TRUE, environment(curl::has_internet))
-```
-
-
-## Fetching Caucus Meeting Data
-First, load the package:
-
-
-```{r}
-library(legisTaiwan)
-```
-
-Now, let's retrieve caucus meeting records. Note the special date format required:
-
-
-```{r}
-caucus_df <- get_caucus_meetings(
- start_date = "111/09/23",
- end_date = "112/01/19",
- verbose = FALSE
-)
-```
-
-Important notes about date formatting:
-
-- Dates must be in ROC calendar format
-- Format required: "YYY/MM/DD" (with slashes)
-- This differs from the format used in get_bills()
-- Format standardization is planned for version 0.2+
-
-View the retrieved data:
-```{r}
-caucus_df$data
-```
-
-The returned data includes comprehensive information about caucus meetings, such as:
-
-- Meeting dates and times
-- Participating party caucuses
-- Meeting agendas and topics
-- Attendance records
-- Meeting outcomes and decisions
-
-The `docUrl` field provides direct access to the original caucus meeting minutes and documentation. This URL links to the official Legislative Yuan's repository where researchers and the public can view detailed records of caucus deliberations.
-
-```{r}
-caucus_df$data[c("subject", "docUrl")]
-```
-
diff --git a/.Rproj.user/763C8F27/sources/session-ab45fd2f/9FB8580D-contents b/.Rproj.user/763C8F27/sources/session-ab45fd2f/9FB8580D-contents
deleted file mode 100644
index de836bbc..00000000
--- a/.Rproj.user/763C8F27/sources/session-ab45fd2f/9FB8580D-contents
+++ /dev/null
@@ -1,61 +0,0 @@
----
-title: "Legislator's Demographic Data"
-author: ""
-output: rmarkdown::html_vignette
-vignette: >
- %\VignetteIndexEntry{Legislator's Demographic Data}
- %\VignetteEngine{knitr::rmarkdown}
- %\VignetteEncoding{UTF-8}
----
-
-```{r, include = FALSE}
-knitr::opts_chunk$set(
- collapse = TRUE,
- comment = "#>"
-)
-```
-
-```{r include=FALSE}
-assign("has_internet_via_proxy", TRUE, environment(curl::has_internet))
-```
-
-## Using `get_legislators()` as an Example to Fetch Legislator Data
-
-
-The get_legislators() function provides a straightforward way to access Taiwan's legislator data from the official parliamentary database. Here's a step-by-step demonstration:
-
-
-```{r}
-library(legisTaiwan)
-```
-
-
-
-First, we load the legisTaiwan package which contains tools for accessing Taiwan's legislative data.
-
-
-```{r}
-info <- get_legislators(verbose = FALSE)
-```
-
-
-Here, we call get_legislators() and store the results in info. The verbose = FALSE parameter suppresses the progress bar during data fetching. This makes the function run quietly without displaying download progress.
-
-
-```{r}
-info$data
-```
-
-
-
-This command displays the retrieved data which includes comprehensive information about legislators. The returned data frame contains various fields about each legislator, such as:
-
-- Personal information (name, gender, birth date)
-- Electoral district details
-- Party affiliation
-- Committee and more!
-
-Each row represents a unique legislator, making it easy to analyze or extract specific information about Taiwan's parliamentary representatives.
-
-
-
diff --git a/.Rproj.user/763C8F27/sources/session-ab45fd2f/A12AFA58-contents b/.Rproj.user/763C8F27/sources/session-ab45fd2f/A12AFA58-contents
deleted file mode 100644
index 4927fcc8..00000000
--- a/.Rproj.user/763C8F27/sources/session-ab45fd2f/A12AFA58-contents
+++ /dev/null
@@ -1,250 +0,0 @@
-#' Check Each Function's Manual
-#'
-#'@author David Liao (davidycliao@@gmail.com)
-#'
-#'@description `get_variable_info` generate each API's endpoint manual returned
-#'from the website of Taiwan Legislative Yuan. The avalaible options is: `get_bills`,
-#'`get_bills_2`, `get_meetings`, `get_caucus_meetings`, `get_speech_video` ,
-#'`get_public_debates`, `get_parlquestions`, `get_executive_response` and
-#'`get_committee_record`.
-#'
-#'@param param_ characters. Must be one of options below: \describe{
-#' \item{get_bills}{get_bills: the records of the bills, see \url{https://data.ly.gov.tw/getds.action?id=6}}
-#' \item{get_bills_2}{the records of legislators and the government proposals, see \url{https://data.ly.gov.tw/getds.action?id=6}}
-#' \item{get_meetings}{the spoken meeting records, see \url{https://www.ly.gov.tw/Pages/List.aspx?nodeid=154}}
-#' \item{get_caucus_meetings}{the meeting records of cross-caucus session, see \url{https://data.ly.gov.tw/getds.action?id=8}}
-#' \item{get_speech_video}{the full video information of meetings and committees, see \url{https://data.ly.gov.tw/getds.action?id=148}}
-#' \item{get_public_debates}{the records of national public debates, see \url{https://data.ly.gov.tw/getds.action?id=7}}
-#' \item{get_parlquestions}{the records of parliamentary questions, see \url{https://data.ly.gov.tw/getds.action?id=6}}
-#' \item{get_executive_response}{the records of the questions answered by the executives, see \url{https://data.ly.gov.tw/getds.action?id=2}}
-#'}
-#'
-#'@return list \describe{
-#' \item{`page_info`}{information of the end point}
-#' \item{`reference_url`}{the url of the page}}
-#'
-#'@details `get_variable_info` produces a list, which contains `page_info` and `reference_url`.
-#'
-#'@importFrom attempt stop_if_all
-#'@importFrom jsonlite fromJSON
-#'@importFrom rvest html_text2 read_html
-#'@importFrom tibble as_tibble
-#'
-#' @export
-#'
-#' @seealso `review_session_info()`.
-#'
-#' @examples
-#' \dontrun{
-#' get_variable_info("get_bills")
-#' }
-# get_variable_info <- function(param_) {
-# check_internet()
-# attempt::stop_if_all(website_availability(), isFALSE, msg = "the error from the API.")
-# attempt::stop_if_all(param_, is.numeric, msg = "use string format only.")
-# attempt::stop_if_all(param_, is.null, msg = "use correct funtion names.")
-# attempt::stop_if(param_ , ~ length(.x) >1, msg = "only allowed to query one function.")
-# if (param_ == "get_parlquestions") {
-# url <- "https://data.ly.gov.tw/getds.action?id=6"
-# }
-# else if (param_ == "get_legislators") {
-# url <- "https://data.ly.gov.tw/getds.action?id=16"
-# }
-# else if (param_ == "get_committee_record") {
-# url <- "https://data.ly.gov.tw/getds.action?id=46"
-# }
-# else if (param_ == "get_executive_response") {
-# url <- "https://data.ly.gov.tw/getds.action?id=2"
-# }
-# else if (param_ == "get_caucus_meetings") {
-# url <- "https://data.ly.gov.tw/getds.action?id=8"
-# }
-# else if (param_ == "get_speech_video") {
-# url <- "https://data.ly.gov.tw/getds.action?id=148"
-# }
-# else if (param_ == "get_bills_2") {
-# url <- "https://data.ly.gov.tw/getds.action?id=20"
-# }
-# else if (param_ == "get_public_debates") {
-# url <- "https://data.ly.gov.tw/getds.action?id=7"
-# }
-# else if (param_ %in% c("get_bills", "get_meetings")) {
-# if (param_ == "get_meetings") {
-# url <- "https://www.ly.gov.tw/Pages/List.aspx?nodeid=154"
-# }
-# else if (param_ == "get_bills") {
-# url <- "https://www.ly.gov.tw/Pages/List.aspx?nodeid=153"
-# }
-# html_info <- rvest::html_text2(rvest::html_nodes(rvest::html_nodes(rvest::read_html(url), "*[id='form_Query']"), "div") )
-# page_info <- list(page_info = strsplit(html_info[14], split = "\n")[[1]], reference_url = url)
-# return(page_info)
-# }
-# else {
-# stop("Use correct funtion names below in character format:
-# get_bills: the records of the bills
-# get_bills_2: the records of legislators and the government proposals
-# get_meetings: the spoken meeting records
-# get_caucus_meetings: the meeting records of cross-caucus session
-# get_speech_video: the full video information of meetings and committees
-# get_public_debates: the records of national public debates
-# get_parlquestions: the records of parliamentary questions
-# get_executive_response: the records of the questions answered by the executives")
-# }
-# html <- rvest::html_nodes(rvest::read_html(url), "*[id='content']")
-# title <- gsub("[[:space:]]", "", rvest::html_text2(rvest::html_nodes(html, "h2")))
-#
-# content <- gsub("[[:space:]]", "", rvest::html_text2(rvest::html_nodes(html, "span")))
-# df <- data.frame(content[seq(1, length(content), 2 )],
-# content[seq(1, length(content) + 1, 2 ) -1])
-# colnames(df) <- c(title[2], title[1])
-# df <- tibble::as_tibble(df)
-# page_info <- list(page_info = df, reference_url = url)
-# return(page_info)
-# }
-
-get_variable_info <- function(param_) {
- # Ensure internet and website availability
- check_internet()
- attempt::stop_if_not(website_availability(), msg = "the error from the API.")
-
- # Parameter checks
- attempt::stop_if(param_, is.numeric, msg = "use string format only.")
- attempt::stop_if(param_, is.null, msg = "use correct function names.")
- attempt::stop_if(param_, ~ length(.x) > 1, msg = "only allowed to query one function.")
-
- # Dictionary for URL mapping
- url_mapping <- list(
- get_parlquestions = "https://data.ly.gov.tw/getds.action?id=6",
- get_legislators = "https://data.ly.gov.tw/getds.action?id=16",
- get_committee_record = "https://data.ly.gov.tw/getds.action?id=46",
- get_executive_response = "https://data.ly.gov.tw/getds.action?id=2",
- get_caucus_meetings = "https://data.ly.gov.tw/getds.action?id=8",
- get_speech_video = "https://data.ly.gov.tw/getds.action?id=148",
- get_bills_2 = "https://data.ly.gov.tw/getds.action?id=20",
- get_public_debates = "https://data.ly.gov.tw/getds.action?id=7"
- )
- if (!(param_ %in% names(url_mapping) || param_ %in% c("get_bills", "get_meetings"))) {
- stop("Use correct function names below in character format:
- get_bills: the records of the bills
- get_bills_2: the records of legislators and the government proposals
- get_meetings: the spoken meeting records
- get_caucus_meetings: the meeting records of cross-caucus session
- get_speech_video: the full video information of meetings and committees
- get_public_debates: the records of national public debates
- get_parlquestions: the records of parliamentary questions
- get_executive_response: the records of the questions answered by the executives")
- }
-
-
- # Fetch URL from dictionary or process special cases
- if (param_ %in% names(url_mapping)) {
- url <- url_mapping[[param_]]
- } else if (param_ == "get_meetings") {
- url <- "https://www.ly.gov.tw/Pages/List.aspx?nodeid=154"
- } else if (param_ == "get_bills") {
- url <- "https://www.ly.gov.tw/Pages/List.aspx?nodeid=153"
- } else {
- stop("Use correct function names below in character format.")
- }
-
- if (param_ %in% c("get_bills", "get_meetings")) {
- html_info <- rvest::html_text2(rvest::html_nodes(rvest::html_nodes(rvest::read_html(url), "*[id='form_Query']"), "div"))
- page_info <- list(page_info = strsplit(html_info[14], split = "\n")[[1]], reference_url = url)
- return(page_info)
- }
-
- html <- rvest::html_nodes(rvest::read_html(url), "*[id='content']")
- title <- gsub("[[:space:]]", "", rvest::html_text2(rvest::html_nodes(html, "h2")))
-
- content <- gsub("[[:space:]]", "", rvest::html_text2(rvest::html_nodes(html, "span")))
- df <- data.frame(content[seq(1, length(content), 2)],
- content[seq(1, length(content) + 1, 2) - 1])
- colnames(df) <- c(title[2], title[1])
- df <- tibble::as_tibble(df)
- page_info <- list(page_info = df, reference_url = url)
-
- return(page_info)
-}
-
-
-#' Check Session Periods in Each Year (Minguo Calendar)
-#'
-#'@author David Liao (davidycliao@@gmail.com)
-#'
-#'@details `review_session_info` produces a dataframe, displaying each session
-#'period in year formatted in Minguo (Taiwan) calendar.
-#'
-#'@param term numeric
-#'
-#'@return dataframe
-#'
-#'@importFrom attempt stop_if_all
-#'@importFrom rvest html_text2 read_html
-#'@importFrom tibble as_tibble
-#'
-#' @seealso
-#' Regarding Minguo calendar, please see \url{https://en.wikipedia.org/wiki/Republic_of_China_calendar}.
-#'
-#' @examples
-#' \dontrun{
-#' review_session_info(7)
-#' }
-
-review_session_info <- function(term) {
- # Input validation
- if(missing(term)) {
- stop("Term parameter is required")
- }
-
- attempt::stop_if_not(website_availability2(),
- msg = "API connection error. Please check your internet connection.")
-
- attempt::stop_if(term, is.null,
- msg = "Term cannot be NULL. Please provide a valid term number (1-11).")
-
- attempt::stop_if_not(term %in% 1:11,
- msg = paste("Invalid term:", term,
- "\nPlease provide a term number between 1 and 11."))
-
- # Construct URL
- url <- sprintf("https://npl.ly.gov.tw/do/www/appDate?status=0&expire=%02d&startYear=0",
- as.numeric(term))
-
- tryCatch({
- # Parse HTML
- html_ <- rvest::html_nodes(rvest::read_html(url),
- "*[class='section_wrapper']")
-
- # Extract titles
- title <- stringr::str_split_1(
- rvest::html_text2(
- rvest::html_nodes(html_, "[class='tt_titlebar2']")
- ),
- "\t\r"
- )[1:2]
-
- # Extract rows
- odd_rows <- rvest::html_text2(
- rvest::html_nodes(html_, "[class='tt_listrow_odd']")
- )
- even_rows <- rvest::html_text2(
- rvest::html_nodes(html_, "[class='tt_listrow_even']")
- )
-
- # Process data
- data <- lapply(
- lapply(c(odd_rows, even_rows),
- function(x) stringr::str_split_1(x, "\r\r")),
- function(x) gsub("[[:space:]]", "", x)
- )
-
- # Create dataframe
- df <- do.call(rbind, data)
- colnames(df) <- title
-
- return(tibble::as_tibble(df))
- },
- error = function(e) {
- stop(paste("Error retrieving session information:", e$message))
- })
-}
diff --git a/.Rproj.user/763C8F27/sources/session-ab45fd2f/A4265EBB-contents b/.Rproj.user/763C8F27/sources/session-ab45fd2f/A4265EBB-contents
deleted file mode 100644
index c38f5830..00000000
--- a/.Rproj.user/763C8F27/sources/session-ab45fd2f/A4265EBB-contents
+++ /dev/null
@@ -1,44 +0,0 @@
-# Test infos
-test_that("get_variable_info", {
-expect_error(get_variable_info("x"),
- "Use correct function names below in character format:
- get_bills: the records of the bills
- get_bills_2: the records of legislators and the government proposals
- get_meetings: the spoken meeting records
- get_caucus_meetings: the meeting records of cross-caucus session
- get_speech_video: the full video information of meetings and committees
- get_public_debates: the records of national public debates
- get_parlquestions: the records of parliamentary questions
- get_executive_response: the records of the questions answered by the executives")
-})
-
-
-
-# For get_variable_info function
-test_that("get_variable_info works correctly", {
- result <- get_variable_info("get_bills")
-
- # Check if the function returns a list
- expect_true(is.list(result))
-
- # Check if the list contains specific elements
- expect_true("page_info" %in% names(result))
- expect_true("reference_url" %in% names(result))
-
- # Check if passing an invalid parameter value results in an error
- expect_error(get_variable_info("invalid_function_name"), "Use correct function names below in character format.")
-})
-
-# For review_session_info function
-test_that("review_session_info works correctly", {
- result <- review_session_info(7)
-
- # Check if the function returns a tibble
- expect_true(is(result, "tbl_df"))
-
- # Check if the tibble contains specific column names (this depends on the actual column names)
- expect_true("屆期會期" %in% colnames(result)) # Replace 'ColumnName1' with actual column name
-
- # Check if passing an invalid term value results in an error
- # expect_error(review_session_info(12), "use correct `term`.")
-})
diff --git a/.Rproj.user/763C8F27/sources/session-ab45fd2f/A57FD011-contents b/.Rproj.user/763C8F27/sources/session-ab45fd2f/A57FD011-contents
deleted file mode 100644
index e9b5a826..00000000
--- a/.Rproj.user/763C8F27/sources/session-ab45fd2f/A57FD011-contents
+++ /dev/null
@@ -1,867 +0,0 @@
-#' The Spoken Meeting Records 委員發言
-#'
-#'@author David Liao (davidycliao@@gmail.com)
-#'
-#'@param start_date numeric Must be formatted in Minguo (Taiwan) calendar, e.g. 1090101.
-#'
-#'@param end_date numeric Must be formatted in Minguo (Taiwan) calendar, e.g. 1090102.
-#'
-#'@param meeting_unit NULL The default is NULL, which includes all meeting types
-#' between the starting date and the ending date.
-#'
-#'@param verbose logical, indicates whether `get_meetings` should print out
-#'detailed output when retrieving the data.
-#'
-#'@return list, which contains: \describe{
-#' \item{`title`}{the spoken meeting records }
-#' \item{`query_time`}{the query time}
-#' \item{`retrieved_number`}{the number of the observation}
-#' \item{`meeting_unit`}{the meeting unit}
-#' \item{`start_date_ad`}{the start date in POSIXct}
-#' \item{`end_date_ad`}{the end date in POSIXct}
-#' \item{`start_date`}{the start date in ROC Taiwan calendar}
-#' \item{`url`}{the retrieved json url}
-#' \item{`variable_names`}{the variables of the tibble dataframe}
-#' \item{`manual_info`}{the offical manual, \url{https://www.ly.gov.tw/Pages/List.aspx?nodeid=154}; or use get_variable_info("get_meetings")}
-#' \item{`data`}{a tibble dataframe, whose variables include:
-#' \describe{\item{`smeeting_date`}{會議日期}
-#' \item{`meeting_status`}{會議狀態}
-#' \item{`meeting_name`}{會議名稱}
-#' \item{`meeting_content`}{會議事由}
-#' \item{`speechers`}{委員發言名單}
-#' \item{`meeting_unit`}{主辦單位}
-#' \item{`date_ad`}{西元年}
-#' }
-#' }
-#' }
-#'
-#'@import utils
-#'@importFrom attempt stop_if_all
-#'@importFrom jsonlite fromJSON
-#'@importFrom withr with_options
-#'
-#'@export
-#'
-#'@examples
-#' ## query meeting records by a period of the dates in Minguo (Taiwan) calendar
-#' ## 輸入「中華民國民年」下載「委員發言」
-#'get_meetings(start_date = "1050120", end_date = "1050210")
-#'
-#' ## query meeting records by a period of the dates in Minguo (Taiwan) calendar format
-#' ## and a meeting
-#' ## 輸入「中華民國民年」與「審查會議或委員會名稱」下載會議審查資訊
-#'get_meetings(start_date = 1060120, end_date = 1070310, meeting_unit = "內政委員會")
-#'
-#'@details `get_meetings` produces a list, which contains `title`, `query_time`,
-#'`retrieved_number`, `meeting_unit`, `start_date_ad`, `end_date_ad`, `start_date`,
-#'`end_date`, `url`, `variable_names`, `manual_info` and `data`.
-#'
-#'@note To retrieve the user manual and more information about variable of the data
-#'frame, please use `get_variable_info("get_meetings")` or visit
-#'the API manual at \url{https://www.ly.gov.tw/Pages/List.aspx?nodeid=154}.
-#'資料似乎不一致,待確認。委員發言(取得最早時間不詳,待檢查。)
-#'
-#'@seealso
-#'`get_variable_info("get_meetings")`
-#'
-#'@seealso
-#' Regarding Minguo calendar, please see \url{https://en.wikipedia.org/wiki/Republic_of_China_calendar}.
-
-get_meetings <- function(start_date = NULL, end_date = NULL, meeting_unit = NULL,
- verbose = TRUE) {
- check_internet()
- api_check(start_date = check_date(start_date), end_date = check_date(end_date))
- set_api_url <- paste("https://www.ly.gov.tw/WebAPI/LegislativeSpeech.aspx?from=",
- start_date, "&to=", end_date, "&meeting_unit=", meeting_unit, "&mode=json", sep = "")
- tryCatch(
- {
- with_options(list(timeout = max(1000, getOption("timeout"))),{json_df <- jsonlite::fromJSON(set_api_url)})
- df <- tibble::as_tibble(json_df)
- attempt::stop_if_all(nrow(df) == 0, isTRUE, msg = "The query is unavailable.")
- df["date_ad"] <- do.call("c", lapply(df$smeeting_date, transformed_date_meeting))
- if (isTRUE(verbose)) {
- cat(" Retrieved URL: \n", set_api_url, "\n")
- cat(" Retrieved via :", meeting_unit, "\n")
- cat(" Retrieved date between:", as.character(check_date(start_date)), "and", as.character(check_date(end_date)), "\n")
- cat(" Retrieved number:", nrow(df), "\n")
- }
- list_data <- list("title" = "the spoken meeting records",
- "query_time" = Sys.time(),
- "retrieved_number" = nrow(df),
- "meeting_unit" = meeting_unit,
- "start_date_ad" = check_date(start_date),
- "end_date_ad" = check_date(end_date),
- "start_date" = start_date,
- "end_date" = end_date,
- "url" = set_api_url,
- "variable_names" = colnames(df),
- "manual_info" = "https://www.ly.gov.tw/Pages/List.aspx?nodeid=154",
- "data" = df)
- return(list_data)
- },
- error = function(error_message) {
- message(error_message)
- }
- )
-}
-
-
-#' The Meeting Records of Cross-caucus Session 黨團協商資訊
-#'
-#'@author David Liao (davidycliao@@gmail.com)
-#'
-#'@param start_date character Must be formatted in Minguo (ROC) calendar with three
-#'forward slashes between year, month and day, e.g. "106/10/20".
-#'
-#'@param end_date character Must be formatted in Minguo (ROC) calendar with three
-#'forward slashes between year, month and day, e.g. "109/01/10".
-#'
-#'@param verbose logical, indicates whether `get_caucus_meetings` should print out
-#'detailed output when retrieving the data.
-#'
-#'@return list, which contains: \describe{
-#' \item{`title`}{the meeting records of cross-caucus session}
-#' \item{`query_time`}{the query time}
-#' \item{`retrieved_number`}{the number of observation}
-#' \item{`meeting_unit`}{the meeting unit}
-#' \item{`start_date_ad`}{the start date in POSIXct}
-#' \item{`end_date_ad`}{the end date in POSIXct}
-#' \item{`start_date`}{the start date in ROC Taiwan calendar}
-#' \item{`url`}{the retrieved json url}
-#' \item{`variable_names`}{the variables of the tibble dataframe}
-#' \item{`manual_info`}{the official manual, \url{https://data.ly.gov.tw/getds.action?id=8}; or use get_variable_info("get_caucus_meetings")}
-#' \item{`data`}{a tibble dataframe, whose variables include:
-#' \describe{\item{`comYear`}{卷}
-#' \item{`comVolume`}{期}
-#' \item{`comBookId`}{冊別}
-#' \item{`term`}{屆別}
-#' \item{`sessionPeriod`}{會期}
-#' \item{`meetingTimes`}{臨時會會次}
-#' \item{`meetingDate`}{會議日期(民國年)}
-#' \item{`meetingName`}{會議名稱}
-#' \item{`subject`}{案由}
-#' \item{`pageStart`}{起始頁}
-#' \item{`pageEnd`}{結束頁}
-#' \item{`docUrl`}{檔案下載位置}
-#' \item{`htmlUrl`}{html網址}
-#' \item{`selectTerm`}{屆別期別篩選條件}
-#' }
-#' }
-#' }
-#'@import utils
-#'@importFrom attempt stop_if_all
-#'@importFrom jsonlite fromJSON
-#'@importFrom withr with_options
-#'
-#'@export
-#'
-#'@examples
-#' ## query the meeting records of cross-caucus session using a period of
-#' ## the dates in Taiwan ROC calender format with forward slash (/).
-#' ## 輸入「中華民國民年」下載「黨團協商」,輸入時間請依照該格式 "106/10/20",
-#' ## 需有「正斜線」做隔開。
-#'get_caucus_meetings(start_date = "106/10/20", end_date = "107/03/10")
-#'
-#'@details `get_caucus_meetings` produces a list, which contains `title`, `query_time`,
-#'`retrieved_number`, `meeting_unit`, `start_date_ad`, `end_date_ad`, `start_date`,
-#'`end_date`, `url`, `variable_names`, `manual_info` and `data.`
-#'\\ifelse{html}{\\href{https://lifecycle.r-lib.org/articles/stages.html#experimental}{\\figure{lifecycle-experimental.svg}{options: alt='[Experimental]'}}}{\\strong{[Experimental]}}
-#'
-#'@note To retrieve the user manual and more information about variable of the data
-#' frame, please use `get_variable_info("get_caucus_meetings")`
-#' or visit the API manual at \url{https://data.ly.gov.tw/getds.action?id=8}.
-#' 議事類:提供公報之黨團協商資訊 (自第8屆第1會期起)
-#'
-#'@seealso
-#'`get_variable_info("get_caucus_meetings")`
-#'
-#'@seealso
-#' Regarding Minguo calendar, please see \url{https://en.wikipedia.org/wiki/Republic_of_China_calendar}.
-get_caucus_meetings <- function(start_date = NULL, end_date = NULL,
- verbose = TRUE) {
- # 檢查日期格式
- date_format_check <- function(date) {
- if (!is.null(date) && !grepl("^\\d{3}/\\d{2}/\\d{2}$", date)) {
- stop(paste("Invalid date format:", date, "\n",
- "Please use the format 'YYY/MM/DD' (ROC calendar),\n",
- "For example: '106/10/20'\n",
- "Where YYY is the ROC year (民國年)"))
- }
- }
-
- check_internet()
- date_format_check(start_date)
- date_format_check(end_date)
-
- if(isTRUE(verbose)) {
- cat("Downloading caucus meetings data...\n")
- pb <- txtProgressBar(min = 0, max = 100, style = 3)
- }
-
- # Update progress bar to 20%
- if(isTRUE(verbose)) setTxtProgressBar(pb, 20)
-
- api_check(start_date = transformed_date_meeting(start_date),
- end_date = transformed_date_meeting(end_date))
-
- # Update progress bar to 40%
- if(isTRUE(verbose)) setTxtProgressBar(pb, 40)
-
- set_api_url <- paste("https://data.ly.gov.tw/odw/ID8Action.action?comYear=&comVolume=&comBookId=&term=&sessionPeriod=&sessionTimes=&meetingTimes=&meetingDateS=",
- start_date, "&meetingDateE=", end_date, "&fileType=json", sep = "")
-
- tryCatch(
- {
- # Update progress bar to 60%
- if(isTRUE(verbose)) setTxtProgressBar(pb, 60)
-
- with_options(list(timeout = max(1000, getOption("timeout"))),{
- json_df <- jsonlite::fromJSON(set_api_url)
- })
-
- # Update progress bar to 80%
- if(isTRUE(verbose)) setTxtProgressBar(pb, 80)
-
- df <- tibble::as_tibble(json_df$dataList)
- attempt::stop_if_all(nrow(df) == 0, isTRUE, msg = "The query is unavailable.")
-
- # Update progress bar to 100% and close it
- if(isTRUE(verbose)) {
- setTxtProgressBar(pb, 100)
- close(pb)
- cat("\n\n") # Add newlines after progress bar
- cat("====== Retrieved Information ======\n")
- cat("-----------------------------------\n")
- cat(" URL: \n", set_api_url, "\n")
- cat(" Date Range: ", as.character(transformed_date_meeting(start_date)),
- " to ", as.character(transformed_date_meeting(end_date)), "\n")
- cat(" Total Meetings: ", nrow(df), "\n")
- cat("===================================\n")
- }
-
- list_data <- list("title" = "the meeting records of cross-caucus session",
- "query_time" = Sys.time(),
- "retrieved_number" = nrow(df),
- "start_date_ad" = transformed_date_meeting(start_date),
- "end_date_ad" = transformed_date_meeting(end_date),
- "start_date" = start_date,
- "end_date" = end_date,
- "url" = set_api_url,
- "variable_names" = colnames(df),
- "manual_info" = "https://data.ly.gov.tw/getds.action?id=8",
- "data" = df)
- return(list_data)
- },
- error = function(error_message) {
- if(isTRUE(verbose)) {
- close(pb)
- cat("\n")
- }
- message(error_message)
- }
- )
-}
-
-
-#' The Video Information of Meetings and Committees 院會及委員會之委員發言片段相關影片資訊
-#' @title The Video Information of Meetings and Committees 院會及委員會之委員發言片段相關影片資訊
-#'
-#' @param term numeric or NULL. Legislative term number (e.g., 10). Data is available from the 9th term onwards.
-#' @param session_period numeric or NULL. Session period (1-8).
-#' @param start_date character Must be formatted in Minguo (ROC) calendar with three
-#' forward slashes between year, month and day, e.g. "110/10/01".
-#' @param end_date character Must be formatted in Minguo (ROC) calendar with three
-#' forward slashes between year, month and day, e.g. "110/10/30".
-#' @param verbose logical, indicates whether get_speech_video should print out
-#' detailed output when retrieving the data. Default is TRUE.
-#'
-#' @return list, which contains:
-#' \describe{
-#' \item{`title`}{speech video records}
-#' \item{`query_time`}{query timestamp}
-#' \item{`retrieved_number`}{number of videos retrieved}
-#' \item{`term`}{queried legislative term}
-#' \item{`session_period`}{queried session period}
-#' \item{`start_date_ad`}{start date in POSIXct}
-#' \item{`end_date_ad`}{end date in POSIXct}
-#' \item{`start_date`}{start date in ROC calendar}
-#' \item{`end_date`}{end date in ROC calendar}
-#' \item{`url`}{retrieved API URL}
-#' \item{`variable_names`}{variables in the tibble dataframe}
-#' \item{`manual_info`}{official manual URL}
-#' \item{`data`}{a tibble dataframe containing:
-#' \describe{
-#' \item{`term`}{屆別}
-#' \item{`sessionPeriod`}{會期}
-#' \item{`meetingDate`}{會議日期(西元年)}
-#' \item{`meetingTime`}{會議時間}
-#' \item{`meetingTypeName`}{主辦單位}
-#' \item{`meetingName`}{會議名稱}
-#' \item{`meetingContent`}{會議事由}
-#' \item{`legislatorName`}{委員姓名}
-#' \item{`areaName`}{選區名稱}
-#' \item{`speechStartTime`}{委員發言時間起}
-#' \item{`speechEndTime`}{委員發言時間迄}
-#' \item{`speechRecordUrl`}{發言紀錄網址}
-#' \item{`videoLength`}{影片長度}
-#' \item{`videoUrl`}{影片網址}
-#' \item{`selectTerm`}{屆別期別篩選條件}
-#' }
-#' }
-#' }
-#'
-#' @importFrom attempt stop_if_all
-#' @importFrom jsonlite fromJSON
-#' @importFrom withr with_options
-#'
-#' @export
-#'
-#' @examples
-#' ## Query video information by term, session period and date range
-#' get_speech_video(
-#' term = 10,
-#' session_period = 4,
-#' start_date = "110/10/01",
-#' end_date = "110/10/30"
-#' )
-#'
-#' ## Query without specifying term or session
-#' get_speech_video(
-#' start_date = "110/10/01",
-#' end_date = "110/10/30"
-#' )
-#'
-#' @details The `get_speech_video` function retrieves video information of
-#' legislative meetings and committee sessions. Data is available from the
-#' 9th legislative term onwards (2016/民國105年). The date parameters must
-#' use the ROC calendar format with forward slashes.
-#'
-#' @note For more details about the data variables and API information,
-#' use `get_variable_info("get_speech_video")` or visit the API manual at
-#' \url{https://data.ly.gov.tw/getds.action?id=148}.
-#' 會議類:提供立法院院會及委員會之委員發言片段相關影片資訊 (自第9屆第1會期起)。
-#'
-#' @seealso
-#' `get_variable_info("get_speech_video")` https://data.ly.gov.tw/odw/ID148Action.action?term=10&sessionPeriod=4&meetingDateS=110/10/01&meetingDateE=110/10/30&meetingTime=&legislatorName=&fileType=csv
-get_speech_video <- function(term = NULL,
- session_period = NULL,
- start_date = NULL,
- end_date = NULL,
- verbose = TRUE,
- format = "json") {
- # Check internet connectivity
- check_internet()
-
- # Format validation
- format <- match.arg(format, c("json", "csv"))
-
- if(isTRUE(verbose)) {
- cat("\nInput Format Information:\n")
- cat("------------------------\n")
- cat("Term: Must be numeric (e.g., 8, 9, 10)\n")
- cat("Session Period: Must be numeric (1-8)\n")
- cat("Date Format: YYY/MM/DD (ROC calendar)\n")
- cat("Example: 110/10/01\n")
- cat("------------------------\n\n")
- cat("Downloading speech video data...\n")
- pb <- txtProgressBar(min = 0, max = 100, style = 3)
- }
-
- # Date validation
- if(is.null(start_date) || is.null(end_date)) {
- stop("Both start_date and end_date must be provided")
- }
-
- # Input data validation
- if(!is.null(term)) {
- term_str <- sprintf("%02d", as.numeric(term))
- } else {
- term_str <- ""
- }
-
- if(!is.null(session_period)) {
- session_str <- sprintf("%02d", as.numeric(session_period))
- } else {
- session_str <- ""
- }
-
- # Update progress bar to 20%
- if(isTRUE(verbose)) setTxtProgressBar(pb, 20)
-
- # Construct API URL
- set_api_url <- paste0("https://data.ly.gov.tw/odw/ID148Action.action?",
- "term=", term_str,
- "&sessionPeriod=", session_str,
- "&meetingDateS=", start_date,
- "&meetingDateE=", end_date,
- "&meetingTime=&legislatorName=&fileType=", format)
-
- # Update progress bar to 40%
- if(isTRUE(verbose)) setTxtProgressBar(pb, 40)
-
- tryCatch(
- {
- # Update progress bar to 60%
- if(isTRUE(verbose)) setTxtProgressBar(pb, 60)
-
- if(format == "json") {
- response <- try({
- json_df <- jsonlite::fromJSON(set_api_url)
- if(!is.null(json_df$dataList)) {
- df <- tibble::as_tibble(json_df$dataList)
- } else {
- df <- tibble::tibble()
- }
- }, silent = TRUE)
- } else {
- response <- try({
- df <- readr::read_csv(set_api_url, show_col_types = FALSE)
- }, silent = TRUE)
- }
-
- # Update progress bar to 80%
- if(isTRUE(verbose)) setTxtProgressBar(pb, 80)
-
- # Data validation
- if(nrow(df) == 0) {
- if(isTRUE(verbose)) {
- setTxtProgressBar(pb, 100)
- close(pb)
- cat("\n\n")
- cat("====== Query Result ======\n")
- cat("-------------------------\n")
- cat("No records found. Please check:\n")
- cat("1. Date format (YYY/MM/DD)\n")
- cat("2. Term and session period\n")
- cat("3. Data availability\n")
- cat("-------------------------\n")
- }
- return(NULL)
- }
-
- # Update progress bar to 100%
- if(isTRUE(verbose)) {
- setTxtProgressBar(pb, 100)
- close(pb)
- cat("\n\n")
- cat("====== Retrieved Information ======\n")
- cat("-----------------------------------\n")
- cat(" Retrieved URL: \n", set_api_url, "\n")
- cat(" Term: ", term_str, "\n")
- if(!is.null(session_period)) {
- cat(" Session Period: ", session_period, "\n")
- }
- cat(" Date Range: ", start_date, " to ", end_date, "\n")
- cat(" Total Videos: ", nrow(df), "\n")
- cat(" Format: ", toupper(format), "\n")
- cat("===================================\n")
- }
-
- # Return data
- list_data <- list(
- "title" = "speech video records",
- "query_time" = Sys.time(),
- "retrieved_number" = nrow(df),
- "term" = term_str,
- "session_period" = session_str,
- "start_date" = start_date,
- "end_date" = end_date,
- "format" = format,
- "url" = set_api_url,
- "variable_names" = colnames(df),
- "manual_info" = "https://data.ly.gov.tw/getds.action?id=148",
- "data" = df
- )
- return(list_data)
- },
- error = function(error_message) {
- if(isTRUE(verbose)) {
- close(pb)
- cat("\nError occurred:\n")
- cat(as.character(error_message), "\n")
- }
- return(NULL)
- }
- )
-}
-
-
-#' The Records of National Public Debates 國是論壇
-#'
-#' @param term numeric or NULL. The default is set to 10. Legislative term number
-#' (e.g., 10). Data is officially available from the 8th term onwards, but
-#' testing shows data starts from the 10th term.
-#'
-#' @param session_period numeric or NULL. Session period number (1-8). Default is NULL.
-#' Use `review_session_info()` to see available session periods in ROC calendar.
-#'
-#' @param verbose logical. Whether to display download progress and detailed information.
-#' Default is TRUE.
-#'
-#' @return A list containing:
-#' \describe{
-#' \item{`title`}{public debates records}
-#' \item{`query_time`}{query timestamp}
-#' \item{`retrieved_number`}{number of records retrieved}
-#' \item{`retrieved_term`}{queried legislative term}
-#' \item{`url`}{retrieved API URL}
-#' \item{`variable_names`}{variables in the tibble dataframe}
-#' \item{`manual_info`}{official manual URL or use get_variable_info("get_public_debates")}
-#' \item{`data`}{a tibble dataframe containing:
-#' \describe{
-#' \item{`term`}{屆別}
-#' \item{`sessionPeriod`}{會期}
-#' \item{`sessionTimes`}{會次}
-#' \item{`meetingTimes`}{臨時會會次}
-#' \item{`dateTimeDesc`}{日期時間說明}
-#' \item{`meetingRoom`}{會議地點}
-#' \item{`chairman`}{主持人}
-#' \item{`legislatorName`}{委員姓名}
-#' \item{`speakType`}{發言類型(paper:書面發言,speak:發言)}
-#' \item{`content`}{內容}
-#' \item{`selectTerm`}{屆別期別篩選條件}
-#' }
-#' }
-#' }
-#'
-#' @import utils
-#' @importFrom attempt stop_if_all
-#' @importFrom jsonlite fromJSON
-#' @importFrom withr with_options
-#'
-#' @export
-#'
-#' @examples
-#' # Query public debates for term 10, session period 2
-#' debates <- get_public_debates(term = 10, session_period = 2)
-#'
-#' # Query without specifying session period
-#' debates <- get_public_debates(term = 10)
-#'
-#' @details
-#' The function retrieves records from the National Public Debates (國是論壇),
-#' including both spoken and written opinions. While officially available from
-#' the 8th legislative term, testing indicates data is only available from
-#' the 10th term onwards.
-#'
-#' @note
-#' For more details about the data variables and API information,
-#' use `get_variable_info("get_public_debates")` or visit the API manual at
-#' \url{https://data.ly.gov.tw/getds.action?id=7}.
-#' 議事類: 提供公報之國是論壇資訊,並包含書面意見。
-#' 自第8屆第1會期起,但實測資料從第10屆。
-#'
-#' @seealso
-#' * `get_variable_info("get_public_debates")`
-#' * `review_session_info()`
-#' * For ROC calendar information: \url{https://en.wikipedia.org/wiki/Republic_of_China_calendar}
-get_public_debates <- function(term = NULL, session_period = NULL, verbose = TRUE) {
- check_internet()
-
- if(isTRUE(verbose)) {
- cat("\nInput Format Information:\n")
- cat("------------------------\n")
- cat("Term: Must be numeric (e.g., 8, 9, 10)\n")
- cat("Session Period: Must be numeric (1-8)\n")
- cat("------------------------\n\n")
- cat("Downloading public debates data...\n")
- pb <- txtProgressBar(min = 0, max = 100, style = 3)
- }
-
- # Update progress bar to 20%
- if(isTRUE(verbose)) setTxtProgressBar(pb, 20)
-
- if (is.null(term)) {
- set_api_url <- paste("https://data.ly.gov.tw/odw/ID7Action.action?term=",
- term, "&sessionPeriod=",
- "&sessionTimes=&meetingTimes=&legislatorName=&speakType=&fileType=json",
- sep = "")
- message(" term is not defined...\n You are now requesting full data from the API. Please make sure your connectivity is stable until its completion.\n")
- } else {
- attempt::stop_if_all(term, is.character, msg = "\nPlease use numeric format only.")
- if (length(term) == 1) {
- term <- sprintf("%02d", as.numeric(term))
- } else if (length(term) > 1) {
- if(isTRUE(verbose)) close(pb)
- term <- paste(sprintf("%02d", as.numeric(term)), collapse = "&")
- message("The API is unable to query multiple terms and the retrieved data might not be complete.")
- }
- }
-
- # Update progress bar to 40%
- if(isTRUE(verbose)) setTxtProgressBar(pb, 40)
-
- set_api_url <- paste("https://data.ly.gov.tw/odw/ID7Action.action?term=",
- term, "&sessionPeriod=",
- sprintf("%02d", as.numeric(session_period)),
- "&sessionTimes=&meetingTimes=&legislatorName=&speakType=&fileType=json",
- sep = "")
-
- tryCatch(
- {
- # Update progress bar to 60%
- if(isTRUE(verbose)) setTxtProgressBar(pb, 60)
-
- with_options(list(timeout = max(1000, getOption("timeout"))),{
- json_df <- jsonlite::fromJSON(set_api_url)
- })
-
- # Update progress bar to 80%
- if(isTRUE(verbose)) setTxtProgressBar(pb, 80)
-
- df <- tibble::as_tibble(json_df$dataList)
- attempt::stop_if_all(nrow(df) == 0, isTRUE, msg = "The query is unavailable.")
-
- # Update progress bar to 100%
- if(isTRUE(verbose)) {
- setTxtProgressBar(pb, 100)
- close(pb)
- cat("\n\n") # Add newlines after progress bar
- cat("====== Retrieved Information ======\n")
- cat("-----------------------------------\n")
- cat(" Retrieved URL: \n", set_api_url, "\n")
- cat(" Term: ", term, "\n")
- if(!is.null(session_period)) {
- cat(" Session Period: ", session_period, "\n")
- }
- cat(" Total Records: ", nrow(df), "\n")
- if("legislatorName" %in% colnames(df)) {
- unique_legislators <- length(unique(df$legislatorName))
- cat(" Unique Legislators: ", unique_legislators, "\n")
- }
- cat("===================================\n")
- }
-
- list_data <- list(
- "title" = "public debates records",
- "query_time" = Sys.time(),
- "retrieved_number" = nrow(df),
- "retrieved_term" = term,
- "url" = set_api_url,
- "variable_names" = colnames(df),
- "manual_info" = "https://data.ly.gov.tw/getds.action?id=7",
- "data" = df
- )
- return(list_data)
- },
- error = function(error_message) {
- if(isTRUE(verbose)) {
- close(pb)
- cat("\n")
- }
- message(error_message)
- }
- )
-}
-
-#' The Records of Reviewed Items in the Committees 委員會會議審查之議案項目
-#'
-#'@author David Yen-Chieh Liao
-#'
-#'@param term numeric or null. Data is available only from the 8th term.
-#'The default is set to 10. 參數必須為數值。提供委員會會議審查之議案項目。(自第10屆第1會期起)
-#'
-#'@param session_period integer, numeric or NULL.
-#'`review_session_info()` provides each session period's available options based on the
-#' Minguo (Taiwan) calendar.
-#'
-#'@param verbose logical. This indicates whether `get_executive_response` should
-#'print a detailed output during data retrieval. Default is TRUE.
-#'
-#'@return A list containing:
-#' \item{`title`}{Records of questions answered by executives}
-#' \item{`query_time`}{Time of query}
-#' \item{`retrieved_number`}{Total number of observations}
-#' \item{`retrieved_term`}{Queried term}
-#' \item{`url`}{Retrieved JSON URL}
-#' \item{`variable_names`}{Variables of the tibble dataframe}
-#' \item{`manual_info`}{Official manual, \url{https://data.ly.gov.tw/getds.action?id=46}; or use get_variable_info("get_committee_record")}
-#' \item{`data`}{A tibble dataframe with variables:
-#' \describe{
-#' \item{`term`}{Term number}
-#' \item{`sessionPeriod`}{Session}
-#' \item{`meetingNo`}{Meeting number}
-#' \item{`billNo`}{Bill number}
-#' \item{`selectTerm`}{Term selection filter}
-#' }
-#' }
-#'
-#'@importFrom attempt stop_if_all
-#'@importFrom jsonlite fromJSON
-#'@importFrom withr with_options
-#'
-#'@export
-#'
-#'@examples
-#' ## Query the committee record by term and session period.
-#' ## 輸入「立委屆期」與「會期」下載「委員會審議之議案」
-#'get_committee_record(term = 10, session_period = 1)
-#'
-#'@details `get_committee_record` provides a list which includes `title`,
-#'`query_time`, `retrieved_number`, `retrieved_term`, `url`, `variable_names`,
-#' `manual_info`, and `data`.
-#'
-#'@note
-#' To access the user manual and more information about the data frame's variables,
-#' please refer to `get_variable_info("get_committee_record")` or check the API manual at
-#' \url{https://data.ly.gov.tw/getds.action?id=46}.
-#' This provides agenda items reviewed in committee meetings (from the 10th term, 1st session onwards).
-#'
-#'@seealso
-#'`get_variable_info("get_committee_record")`, `review_session_info()`
-#' The Records of Reviewed Items in the Committees 委員會會議審查之議案項目
-#'
-#'@author David Yen-Chieh Liao
-#'
-#'@param term numeric or null. Data is available only from the 8th term.
-#'The default is set to 10. 參數必須為數值。提供委員會會議審查之議案項目。(自第10屆第1會期起)
-#'
-#'@param session_period integer, numeric or NULL.
-#'`review_session_info()` provides each session period's available options based on the
-#' Minguo (Taiwan) calendar.
-#'
-#'@param verbose logical. This indicates whether `get_executive_response` should
-#'print a detailed output during data retrieval. Default is TRUE.
-#'
-#'@return A list containing:
-#' \item{`title`}{Records of questions answered by executives}
-#' \item{`query_time`}{Time of query}
-#' \item{`retrieved_number`}{Total number of observations}
-#' \item{`retrieved_term`}{Queried term}
-#' \item{`url`}{Retrieved JSON URL}
-#' \item{`variable_names`}{Variables of the tibble dataframe}
-#' \item{`manual_info`}{Official manual, \url{https://data.ly.gov.tw/getds.action?id=46}; or use get_variable_info("get_committee_record")}
-#' \item{`data`}{A tibble dataframe with variables:
-#' \describe{
-#' \item{`term`}{Term number}
-#' \item{`sessionPeriod`}{Session}
-#' \item{`meetingNo`}{Meeting number}
-#' \item{`billNo`}{Bill number}
-#' \item{`selectTerm`}{Term selection filter}
-#' }
-#' }
-#'
-#' @import utils
-#'@importFrom attempt stop_if_all
-#'@importFrom jsonlite fromJSON
-#'@importFrom withr with_options
-#'
-#'@export
-#'
-#'@examples
-#' ## Query the committee record by term and session period.
-#' ## 輸入「立委屆期」與「會期」下載「委員會審議之議案」
-#'get_committee_record(term = 10, session_period = 1)
-#'
-#'@details `get_committee_record` provides a list which includes `title`,
-#'`query_time`, `retrieved_number`, `retrieved_term`, `url`, `variable_names`,
-#' `manual_info`, and `data`.
-#'
-#'@note
-#' To access the user manual and more information about the data frame's variables,
-#' please refer to `get_variable_info("get_committee_record")` or check the API manual at
-#' \url{https://data.ly.gov.tw/getds.action?id=46}.
-#' This provides agenda items reviewed in committee meetings (from the 10th term, 1st session onwards).
-#'
-#'@seealso
-#'`get_variable_info("get_committee_record")`, `review_session_info()`
-get_committee_record <- function(term = 10, session_period = NULL, verbose = TRUE) {
- check_internet()
-
- if(isTRUE(verbose)) {
- cat("\nInput Format Information:\n")
- cat("------------------------\n")
- cat("Term: Must be numeric (e.g., 8, 9, 10)\n")
- cat("Session Period: Must be numeric (1-8)\n")
- cat("------------------------\n\n")
- cat("Downloading committee records data...\n")
- pb <- txtProgressBar(min = 0, max = 100, style = 3)
- }
-
- # Update progress bar to 20%
- if(isTRUE(verbose)) setTxtProgressBar(pb, 20)
-
- if (is.null(term)) {
- set_api_url <- paste("https://data.ly.gov.tw/odw/ID46Action.action?term=",
- term, "&sessionPeriod=",
- "&sessionTimes=01&meetingTimes=&fileType=json", sep = "")
- message(" term is not defined...\n You are now requesting full data from the API. Please make sure your connectivity is stable until its completion.\n")
- } else {
- attempt::stop_if_all(term, is.character, msg = "use numeric format only.")
- if (length(term) == 1) {
- term <- sprintf("%02d", as.numeric(term))
- } else if (length(term) > 1) {
- if(isTRUE(verbose)) close(pb)
- term <- paste(sprintf("%02d", as.numeric(term)), collapse = "&")
- message("The API is unable to query multiple terms and the retrieved data might not be complete.")
- }
- }
-
- # Update progress bar to 40%
- if(isTRUE(verbose)) setTxtProgressBar(pb, 40)
-
- set_api_url <- paste("https://data.ly.gov.tw/odw/ID46Action.action?term=",
- term,
- "&sessionPeriod=", sprintf("%02d", as.numeric(session_period)),
- "&sessionTimes=01&meetingTimes=&fileType=json", sep = "")
-
- tryCatch(
- {
- # Update progress bar to 60%
- if(isTRUE(verbose)) setTxtProgressBar(pb, 60)
-
- with_options(list(timeout = max(1000, getOption("timeout"))),{
- json_df <- jsonlite::fromJSON(set_api_url)
- })
-
- # Update progress bar to 80%
- if(isTRUE(verbose)) setTxtProgressBar(pb, 80)
-
- df <- tibble::as_tibble(json_df$dataList)
- attempt::stop_if_all(nrow(df) == 0, isTRUE, msg = "The query is unavailable.")
-
- # Update progress bar to 100%
- if(isTRUE(verbose)) {
- setTxtProgressBar(pb, 100)
- close(pb)
- cat("\n\n") # Add newlines after progress bar
- cat("====== Retrieved Information ======\n")
- cat("-----------------------------------\n")
- cat(" Retrieved URL: \n", set_api_url, "\n")
- cat(" Term: ", term, "\n")
- if(!is.null(session_period)) {
- cat(" Session Period: ", session_period, "\n")
- }
- cat(" Total Records: ", nrow(df), "\n")
-
- if("committee" %in% colnames(df)) {
- committee_counts <- table(df$committee)
- cat("\nCommittee Distribution:\n")
- for(comm in names(committee_counts)) {
- cat(sprintf(" %s: %d\n", comm, committee_counts[comm]))
- }
- }
- cat("===================================\n")
- }
-
- list_data <- list(
- "title" = "the records of reviewed items in the committees",
- "query_time" = Sys.time(),
- "retrieved_number" = nrow(df),
- "retrieved_term" = term,
- "url" = set_api_url,
- "variable_names" = colnames(df),
- "manual_info" = "https://data.ly.gov.tw/getds.action?id=46",
- "data" = df
- )
- return(list_data)
- },
- error = function(error_message) {
- if(isTRUE(verbose)) {
- close(pb)
- cat("\n")
- }
- message(error_message)
- }
- )
-}
diff --git a/.Rproj.user/763C8F27/sources/session-ab45fd2f/A6ED6EA7-contents b/.Rproj.user/763C8F27/sources/session-ab45fd2f/A6ED6EA7-contents
deleted file mode 100644
index 49e50e2e..00000000
--- a/.Rproj.user/763C8F27/sources/session-ab45fd2f/A6ED6EA7-contents
+++ /dev/null
@@ -1,89 +0,0 @@
----
-title: "The Records of the Bills"
-author: ""
-output: rmarkdown::html_vignette
-vignette: >
- %\VignetteIndexEntry{The Records of the Bills}
- %\VignetteEngine{knitr::rmarkdown}
- %\VignetteEncoding{UTF-8}
----
-
-```{r, include = FALSE}
-knitr::opts_chunk$set(
- collapse = TRUE,
- comment = "#>"
-)
-```
-
-```{r include=FALSE}
-assign("has_internet_via_proxy", TRUE, environment(curl::has_internet))
-```
-
-
-## An Example of the Records of the Bills
-
-First, we'll import legisTaiwan, and then we'll retrieve data from January 20th of the Republic of China year 106 to March 10th of the Republic of China year 111.
-```{r}
-library(legisTaiwan)
-```
-
-
-```{r}
-billdata <- get_bills(start_date = 1030120,
- end_date = 1110310,
- verbose = TRUE)
-```
-
-The get_bills function returns a list that contains query_time, retrieved_number, meeting_unit, start_date_ad (A.D) , end_date_ad (A.D), start_date, end_date, url, variable_names, manual_info, and data.
-```{r}
-billdata$data
-
-
-```
-
-
-```{r}
-full_term <- get_bills_2(term = 11)
-full_term
-```
-
-```{r}
-# 安裝套件
-install.packages("pdftools")
-library(pdftools)
-
-# 讀取 PDF
-pdf_text <- pdf_text("https://ppg.ly.gov.tw/ppg/download/agenda1/02/pdf/11/01/02/LCEWA01_110102_00017.pdf")
-
-
-# 文本清理
-library(stringr)
-library(dplyr)
-
-clean_text <- pdf_text %>%
- str_replace_all("\n", " ") %>% # 移除換行
- str_replace_all("\\s+", " ") %>% # 移除多餘空白
- str_trim() # 移除前後空白
-
-# 斷詞(如果需要)
-library(jiebaR)
-cutter <- worker()
-words <- segment(clean_text, cutter)
-
-library(httr)
-library(pdftools)
-
-# 下載 PDF
-response <- GET(url)
-writeBin(content(response, "raw"), temp_file)
-pdf_text <- pdf_text(temp_file)
-# 處理編碼問題(如果有需要)
-pdf_text <- iconv(pdf_text, "UTF-8", "UTF-8")
-
-# 如果要分頁處理,可以用以下方式:
-for(i in seq_along(pdf_text)) {
- cat("=== 第", i, "頁 ===\n")
- cat(pdf_text[i])
-}
-```
-
diff --git a/.Rproj.user/763C8F27/sources/session-ab45fd2f/A925826F b/.Rproj.user/763C8F27/sources/session-ab45fd2f/A925826F
deleted file mode 100644
index 10598dbd..00000000
--- a/.Rproj.user/763C8F27/sources/session-ab45fd2f/A925826F
+++ /dev/null
@@ -1,26 +0,0 @@
-{
- "id": "A925826F",
- "path": "~/Dropbox/My Packages/legisTaiwan/DESCRIPTION",
- "project_path": "DESCRIPTION",
- "type": "dcf",
- "hash": "0",
- "contents": "",
- "dirty": false,
- "created": 1735334709942.0,
- "source_on_save": false,
- "relative_order": 2,
- "properties": {
- "source_window_id": "",
- "Source": "Source",
- "cursorPosition": "48,0",
- "scrollLine": "34"
- },
- "folds": "",
- "lastKnownWriteTime": 1735335879,
- "encoding": "UTF-8",
- "collab_server": "",
- "source_window": "",
- "last_content_update": 1735335879573,
- "read_only": false,
- "read_only_alternatives": []
-}
\ No newline at end of file
diff --git a/.Rproj.user/763C8F27/sources/session-ab45fd2f/A925826F-contents b/.Rproj.user/763C8F27/sources/session-ab45fd2f/A925826F-contents
deleted file mode 100644
index 1fff29f0..00000000
--- a/.Rproj.user/763C8F27/sources/session-ab45fd2f/A925826F-contents
+++ /dev/null
@@ -1,50 +0,0 @@
-Package: legisTaiwan
-Type: Package
-Title: An Interface to Access Taiwan Legislative API in R
-Version: 0.1.7
-Authors@R: c(person("Yen-Chieh", "Liao", email = "davidycliao@gmail.com", role = c("aut", "cre")),
- person("Li", "Tang", email = "li.tang@reading.ac.uk", role = c("ctb", "aut")),
- person("Taiwan Legislative Yuan 立法院", role = c("cph", "fnd")),
- person("Taiwan National Science and Technology Council", role = "ctb"),
- person("Taiwan Science & Technology Policy Research and Information Center NARLabs", role = "ctb"))
-Description: The pacakge is designed to make it quickly and easy to access Taiwan
- Legislative Yuan API for downloading real-time data legislative and
- historical archives.
-Maintainer: Yen-Chieh Liao
-Depends: R (>= 3.4.0)
-License: GPL-3 + file LICENSE
-Encoding: UTF-8
-LazyData: true
-Imports:
- jsonlite,
- attempt,
- stringr,
- curl,
- tibble,
- rvest,
- withr,
- httr,
- utils,
- readr
-Suggests:
- knitr,
- rmarkdown,
- ggplot2,
- remotes,
- tidyverse,
- testthat (>= 3.0.0)
-RoxygenNote: 7.3.2
-BugReports: https://github.com/davidycliao/legisTaiwan/issues
-URL: https://davidycliao.github.io/legisTaiwan/
-VignetteBuilder: knitr
-Roxygen: list(markdown = TRUE)
-Config/testthat/edition: 3
-SystemRequirements: pandoc (>= 1.14) - http://pandoc.org
-Config/build/clean-inst-doc: FALSE
-Config/build/clean-check-dir: FALSE
-Config/build/ignore-non-ascii: TRUE
-Config/default/Rcheck/ignore-ascii: TRUE
-Config/default/Rcheck/ascii: FALSE
-Config/default/Rcheck/incoming: FALSE
-NeedsCompilation: no
-AS-CRAN: FALSE
diff --git a/.Rproj.user/763C8F27/sources/session-ab45fd2f/AA256903-contents b/.Rproj.user/763C8F27/sources/session-ab45fd2f/AA256903-contents
deleted file mode 100644
index 6cdadc46..00000000
--- a/.Rproj.user/763C8F27/sources/session-ab45fd2f/AA256903-contents
+++ /dev/null
@@ -1,23 +0,0 @@
-test_that("get_bills", {
- expect_equal(get_bills(start_date = 1060120, end_date = 1070310, proposer = "孔文吉", verbose = FALSE)$retrieved_number, 9)
-})
-
-test_that("get_bills_2", {
- expect_equal(get_bills_2(term = 8, session_period = 1, verbose = FALSE)$retrieved_number, 1155)
- expect_error(get_bills_2(term = "10"), "Please use numeric format only.")
- expect_error(get_bills_2(term = "10", verbose = TRUE), "Please use numeric format only.")
-})
-
-test_that("Testing get_bills function", {
-
- # Test if the function returns a list
- result <- get_bills(start_date = 1060120, end_date = 1070310, verbose = FALSE)
- expect_type(result, "list")
- # Test if get_bills throws the expected error for incorrect date format
- expect_error(get_bills(start_date = 1070310, end_date = 1060120, verbose = FALSE),
- "The start date, 2018-03-10, should not be later than the end date, 2017-01-20.")
-
- # Test if the function correctly handles invalid date format
- expect_error(get_bills(start_date = "10601", end_date = 1070310, verbose = FALSE),
- "Dates should be in numeric format. E.g., 1090101.")
-})
diff --git a/.Rproj.user/763C8F27/sources/session-ab45fd2f/AC7FC4AB-contents b/.Rproj.user/763C8F27/sources/session-ab45fd2f/AC7FC4AB-contents
deleted file mode 100644
index 01e651a6..00000000
--- a/.Rproj.user/763C8F27/sources/session-ab45fd2f/AC7FC4AB-contents
+++ /dev/null
@@ -1,2 +0,0 @@
-*.html
-^.*\.utf8\.R$
diff --git a/.Rproj.user/763C8F27/sources/session-ab45fd2f/AEAF1ED3 b/.Rproj.user/763C8F27/sources/session-ab45fd2f/AEAF1ED3
deleted file mode 100644
index b8448abd..00000000
--- a/.Rproj.user/763C8F27/sources/session-ab45fd2f/AEAF1ED3
+++ /dev/null
@@ -1,26 +0,0 @@
-{
- "id": "AEAF1ED3",
- "path": "~/Dropbox/My Packages/legisTaiwan/.Rbuildignore",
- "project_path": ".Rbuildignore",
- "type": "text",
- "hash": "0",
- "contents": "",
- "dirty": false,
- "created": 1735335769167.0,
- "source_on_save": false,
- "relative_order": 4,
- "properties": {
- "source_window_id": "",
- "Source": "Source",
- "cursorPosition": "17,0",
- "scrollLine": "0"
- },
- "folds": "",
- "lastKnownWriteTime": 1735341806,
- "encoding": "UTF-8",
- "collab_server": "",
- "source_window": "",
- "last_content_update": 1735341806622,
- "read_only": false,
- "read_only_alternatives": []
-}
\ No newline at end of file
diff --git a/.Rproj.user/763C8F27/sources/session-ab45fd2f/AEAF1ED3-contents b/.Rproj.user/763C8F27/sources/session-ab45fd2f/AEAF1ED3-contents
deleted file mode 100644
index 0fd85cf3..00000000
--- a/.Rproj.user/763C8F27/sources/session-ab45fd2f/AEAF1ED3-contents
+++ /dev/null
@@ -1,17 +0,0 @@
-^\.github$
-^.*\.Rproj$
-^\.Rproj\.user$
-^_pkgdown\.yml$
-^docs$
-^pkgdown$
-^\.github$
-^codecov\.yml$
-^\.Rcheck$
-^.*\.utf8\.R$
-^README\.Rmd$
-
-^.*\.Rproj$
-^\.Rproj\.user$
-^README\.Rmd$
-^cran-comments\.md$
-^\.github$
diff --git a/.Rproj.user/763C8F27/sources/session-ab45fd2f/B18BBF61-contents b/.Rproj.user/763C8F27/sources/session-ab45fd2f/B18BBF61-contents
deleted file mode 100644
index b7f0fa98..00000000
--- a/.Rproj.user/763C8F27/sources/session-ab45fd2f/B18BBF61-contents
+++ /dev/null
@@ -1,52 +0,0 @@
----
-title: "Quick Start"
-output: rmarkdown::html_vignette
-vignette: >
- %\VignetteIndexEntry{Quick Start}
- %\VignetteEngine{knitr::rmarkdown}
- %\VignetteEncoding{UTF-8}
----
-
-```{r, include = FALSE}
-knitr::opts_chunk$set(
- collapse = TRUE,
- comment = "#>"
-)
-```
-
-## Get Started with Using [`remotes`](https://github.com/r-lib/remotes):
-
-
-
-**`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.
-
-
-
-
-```{r eval = FALSE}
-install.packages("remotes")
-remotes::install_github("davidycliao/legisTaiwan", force = TRUE)
-```
-
-```{r}
-library(legisTaiwan)
-```
-
-
-
------
-
-
-
-## How to Contribute
-
-
-
-{`legisTaiwan`} is an open source project in R. Contributions in the form of comments, code suggestions, and tutorial examples are very welcome. Please note that the `LeigsTaiwan` is released with the [Contributor Code of Conduct](https://github.com/davidycliao/legisTaiwan/blob/master/CONDUCT.md). By contributing to this project, you agree to abide by its terms.
-
-
-
-
-
-
diff --git a/.Rproj.user/763C8F27/sources/session-ab45fd2f/B3F4150C-contents b/.Rproj.user/763C8F27/sources/session-ab45fd2f/B3F4150C-contents
deleted file mode 100644
index 93824fda..00000000
--- a/.Rproj.user/763C8F27/sources/session-ab45fd2f/B3F4150C-contents
+++ /dev/null
@@ -1,154 +0,0 @@
----
-title: "Fetching Parliarmentary Questions"
-author: ""
-output: rmarkdown::html_vignette
-vignette: >
- %\VignetteIndexEntry{Fetching Parliarmentary Questions}
- %\VignetteEngine{knitr::rmarkdown}
- %\VignetteEncoding{UTF-8}
----
-
-```{r, include = FALSE}
-knitr::opts_chunk$set(
- collapse = TRUE,
- comment = "#>"
-)
-```
-
-
-```{r include=FALSE}
-assign("has_internet_via_proxy", TRUE, environment(curl::has_internet))
-library(legisTaiwan)
-```
-
-## Accessing Parliamentary Questions with legisTaiwan Package
-
-
-This tutorial demonstrates how to use the legisTaiwan package to access parliamentary questions and executive responses from Taiwan's Legislative Yuan. The package provides convenient functions to fetch publicly available data.
-
-
-
-### Loading the Package
-First, install and load the legisTaiwan package:
-```{r}
-library(legisTaiwan)
-```
-
-### Fetching Parliamentary Questions
-
-
-
-Use the `get_parlquestions()` function to retrieve parliamentary questions from legislators:
-
-
-
-```{r}
-# Fetch questions from the 11th term
-pa_term10 <- get_parlquestions(term = 11, verbose = TRUE)
-
-# Examine the data structure
-str(pa_term10)
-```
-
-__Function parameters:__
-
-- `term`: Legislative term (must be numeric, e.g., 11)
-- `session_period`: Session period (optional)
-- `verbose = TRUE`: Display download progress and information
-
-__The returned data contains:__
-
-- `title`: Data title
-- `query_time`: Query timestamp
-`_retrieved_number`: Number of records retrieved
-- `data`: A dataframe containing:
- + term: Legislative term
- + sessionPeriod: Session period
- + sessionTimes: Session count
- + item: Question items
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-### Retrieving Executive Responses
-Use the get_executive_response() function to fetch responses from the Executive Yuan:
-
-```{r}
-# Fetch executive responses from the 10th term, 2nd session
-exec_response <- get_executive_response(term = 10, session_period = 2, verbose = TRUE)
-
-# Examine the data structure
-head(exec_response$data)
-```
-
-__Function parameters:__
-
-- `term`: Legislative term
-- `session_period`: Session period
-- `verbose = TRUE`: Display download progress and information
-
-__The returned data includes:__
-
-- `title`: Data title
-- `query_time`: Query timestamp
-- `retrieved_number`: Number of records retrieved
-- `data`: A dataframe containing response information
diff --git a/.Rproj.user/763C8F27/sources/session-ab45fd2f/B404E371-contents b/.Rproj.user/763C8F27/sources/session-ab45fd2f/B404E371-contents
deleted file mode 100644
index 7197ebc1..00000000
--- a/.Rproj.user/763C8F27/sources/session-ab45fd2f/B404E371-contents
+++ /dev/null
@@ -1,343 +0,0 @@
-#' The Records of Parliamentary Questions 委員質詢事項資訊
-#'
-#' @author David Liao (davidycliao@@gmail.com)
-#'
-#' @param term numeric or NULL. The default is set to NULL. 參數必須為數值。
-#'
-#' @param session_period integer, numeric or NULL. Available
-#' options for the session is: 1, 2, 3, 4, 5, 6, 7, and 8. The default is set to 8 參數必須為數值。
-#' `review_session_info()` generates each session period available option period
-#' in Minguo (Taiwan) calendar.
-#'
-#' @param verbose logical, indicates whether `get_parlquestions` should print out
-#' detailed output when retrieving the data. The default is TRUE.
-#'
-#' @return A list containing:
-#' \describe{
-#' \item{`title`}{the records of parliamentary questions}
-#' \item{`query_time`}{the queried time}
-#' \item{`retrieved_number`}{the total number of observations}
-#' \item{`retrieved_term`}{the queried term}
-#' \item{`url`}{the retrieved json url}
-#' \item{`variable_names`}{the variables of the tibble dataframe}
-#' \item{`manual_info`}{the offical manual from \url{https://data.ly.gov.tw/getds.action?id=6}, or use get_variable_info("get_parlquestions")}
-#' \item{`data`}{a tibble dataframe, whose variables include:
-#' \describe{
-#' \item{`term`}{屆別}
-#' \item{`sessionPeriod`}{會期}
-#' \item{`sessionTimes`}{會次}
-#' \item{`item`}{項目}
-#' \item{`selectTerm`}{屆別期別篩選條件}
-#' }
-#' }
-#' }
-#' @importFrom attempt stop_if_all
-#' @importFrom jsonlite fromJSON
-#' @importFrom withr with_options
-#' @export
-#'
-#' @examples
-#' ## Query parliamentary questions by term.
-#' ## 輸入「立委會期」下載立委質詢資料
-#' get_parlquestions(term = 10)
-#'
-#' ## Query parliamentary questions by term and session period.
-#' ## 輸入「立委屆期」與「會期」下載立委質詢資料
-#' get_parlquestions(term = 10, session_period = 2)
-#'
-#' @details `get_parlquestions` produces a list, which contains `title`,
-#' `query_time`, `retrieved_number`, `retrieved_term`, `url`, `variable_names`,
-#' `manual_info`, and `data`.
-#'
-#' @note To retrieve the user manual and more information about variable of the data
-#' frame, please use `get_variable_info("get_parlquestions")`
-#' or visit the API manual at \url{https://data.ly.gov.tw/getds.action?id=6}.
-#' 質詢類: 提供議事日程本院委員之質詢事項資訊(自第8屆第1會期起)。
-#'
-#' @seealso `get_variable_info("get_parlquestions")`
-#'
-#' @encoding UTF-8
-get_parlquestions <- function(term = NULL, session_period = NULL, verbose = TRUE) {
- check_internet()
-
- # 先檢查 term 並顯示訊息
- if (is.null(term)) {
- message("\nTerm is not defined...\nRequesting full data from the API. Please ensure stable connectivity.\n")
- }
-
- # 初始化進度顯示
- if(isTRUE(verbose)) {
- cat("\nInput Format Information:\n")
- cat("------------------------\n")
- cat("Term: Must be numeric (e.g., 8, 9, 10)\n")
- cat("Session Period: Must be numeric (1-8)\n")
- cat("------------------------\n\n")
- cat("Downloading parliamentary questions data...\n")
- pb <- txtProgressBar(min = 0, max = 100, style = 3)
- }
-
- # Update progress bar to 20%
- if(isTRUE(verbose)) setTxtProgressBar(pb, 20)
-
- # 建構 API URL
- if (is.null(term)) {
- set_api_url <- paste("https://data.ly.gov.tw/odw/ID6Action.action?term=", term,
- "&sessionPeriod=",
- "&sessionTimes=&item=&fileType=json", sep = "")
- } else {
- attempt::stop_if_all(term, is.character, msg = "Please use numeric format only.")
- if (length(term) == 1) {
- term <- sprintf("%02d", as.numeric(term))
- } else if (length(term) > 1) {
- if(isTRUE(verbose)) close(pb)
- term <- paste(sprintf("%02d", as.numeric(term)), collapse = "&")
- stop("API does not support multiple terms.")
- }
- }
-
- # Update progress bar to 40%
- if(isTRUE(verbose)) setTxtProgressBar(pb, 40)
-
- set_api_url <- paste("https://data.ly.gov.tw/odw/ID6Action.action?term=", term,
- "&sessionPeriod=",
- sprintf("%02d", as.numeric(session_period)),
- "&sessionTimes=&item=&fileType=json", sep = "")
-
- tryCatch(
- {
- # Update progress bar to 60%
- if(isTRUE(verbose)) setTxtProgressBar(pb, 60)
-
- with_options(list(timeout = max(1000, getOption("timeout"))),{
- json_df <- jsonlite::fromJSON(set_api_url)
- })
-
- # Update progress bar to 80%
- if(isTRUE(verbose)) setTxtProgressBar(pb, 80)
-
- df <- tibble::as_tibble(json_df$dataList)
- attempt::stop_if_all(nrow(df) == 0, isTRUE, msg = "Query returned no data.")
-
- # Update progress bar to 100% and show results
- if(isTRUE(verbose)) {
- setTxtProgressBar(pb, 100)
- close(pb)
- cat("\n\n")
- cat("====== Retrieved Information ======\n")
- cat("-----------------------------------\n")
- cat(" URL: \n", set_api_url, "\n")
- cat(" Term: ", term, "\n")
- if(!is.null(session_period)) {
- cat(" Session Period: ", session_period, "\n")
- }
- cat(" Total Questions: ", nrow(df), "\n")
-
- # Add session period distribution if available
- if("sessionPeriod" %in% colnames(df)) {
- session_counts <- table(df$sessionPeriod)
- cat("\nSession Distribution:\n")
- for(session in names(session_counts)) {
- cat(sprintf(" Session %s: %d\n", session, session_counts[session]))
- }
- }
- cat("===================================\n")
- }
-
- # 回傳結果
- list_data <- list(
- "title" = "Parliamentary Questions Records",
- "query_time" = Sys.time(),
- "retrieved_number" = nrow(df),
- "retrieved_term" = term,
- "url" = set_api_url,
- "variable_names" = colnames(df),
- "manual_info" = "https://data.ly.gov.tw/getds.action?id=6",
- "data" = df
- )
- return(list_data)
- },
- error = function(error_message) {
- if(isTRUE(verbose)) {
- close(pb)
- cat("\nError occurred while fetching data:\n")
- cat(sprintf("Error: %s\n", error_message))
- }
- message(error_message)
- }
- )
-}
-
-#'The Records of Response to the Questions by the Executives 公報質詢事項行政院答復資訊
-#'
-#'@author David Liao (davidycliao@@gmail.com)
-#'
-#'@param term integer, numeric or NULL. The default is NULL. The data is only
-#'available from 8th term. 參數必須為數值。資料從自第8屆起,預設值為8。
-#'
-#'@param session_period integer, numeric or NULL. Available
-#'options for the session is: 1, 2, 3, 4, 5, 6, 7, and 8. The default is set to NULL. 參數必須為數值。
-#'`review_session_info()` generates each session period available option period
-#' in Minguo (Taiwan) calendar.
-#'
-#'@param verbose logical, indicates whether `get_executive_response` should
-#'print out detailed output when retrieving the data. The default is set to TRUE
-#'
-#'@return list contains: \describe{
-#' \item{`title`}{the records of the questions answered by the executives}
-#' \item{`query_time`}{the queried time}
-#' \item{`retrieved_number`}{the total number of observations}
-#' \item{`retrieved_term`}{the queried term}
-#' \item{`url`}{the retrieved json url}
-#' \item{`variable_names`}{the variables of the tibble dataframe}
-#' \item{`manual_info`}{the offical manual}
-#' \item{`data`}{a tibble dataframe, whose variables include:
-#' \describe{\item{`term`}{屆別}
-#' \item{`sessionPeriod`}{會期}
-#' \item{`sessionTimes`}{會次}
-#' \item{`meetingTimes`}{臨時會會次}
-#' \item{`eyNumber`}{行政院函公文編號}
-#' \item{`lyNumber`}{立法院函編號}
-#' \item{`subject`}{案由}
-#' \item{`content`}{內容}
-#' \item{`docUrl`}{案由}
-#' \item{`item`}{檔案下載位置}
-#' \item{`item`}{檔案下載位置}
-#' \item{`selectTerm`}{屆別期別篩選條件}
-#' }
-#' }
-#' }
-#'
-#'@importFrom attempt stop_if_all
-#'@importFrom jsonlite fromJSON
-#'@importFrom withr with_options
-#'@export
-#'
-#'@examples
-#' ## query the Executives' answered response by term and the session period.
-#' ## 輸入「立委屆期」與「會期」下載「行政院答復」
-#' get_executive_response(term = 8, session_period = 1)
-#'
-#'@details **`get_executive_response`** produces a list, which contains `title`,
-#'`query_time`, `retrieved_number`, `retrieved_term`, `url`, `variable_names`,
-#' `manual_info` and `data`. To retrieve the user manual and more information, please
-#' use `get_variable_info("get_executive_response")`.
-#'
-#'
-#'#'@note To retrieve the user manual and more information about variable of the data
-#' frame, please use `get_variable_info("get_executive_response")`
-#' or visit the API manual at \url{https://data.ly.gov.tw/getds.action?id=2}.
-#' 質詢類: 提供公報質詢事項行政院答復資訊 (自第8屆第1會期起)。
-#'
-#'@seealso
-#'`get_variable_info("get_executive_response")`, `review_session_info()`
-#'
-#' @encoding UTF-8
-get_executive_response <- function(term = NULL, session_period = NULL, verbose = TRUE) {
- check_internet()
-
- # 先檢查 term 並顯示訊息
- if (is.null(term)) {
- message("\nTerm is not defined...\nRequesting full data from the API. Please ensure stable connectivity.\n")
- }
-
- # 初始化進度顯示
- if(isTRUE(verbose)) {
- cat("\nInput Format Information:\n")
- cat("------------------------\n")
- cat("Term: Must be numeric (e.g., 8, 9, 10, 11)\n")
- cat("Session Period: Must be numeric (1-8)\n")
- cat("------------------------\n\n")
- cat("Downloading executive response data...\n")
- pb <- txtProgressBar(min = 0, max = 100, style = 3)
- }
-
- # Update progress bar to 20%
- if(isTRUE(verbose)) setTxtProgressBar(pb, 20)
-
- # 建構 API URL
- if (is.null(term)) {
- set_api_url <- paste("https://data.ly.gov.tw/odw/ID2Action.action?term=",
- term, "&sessionPeriod=",
- "&sessionTimes=&item=&fileType=json", sep = "")
- } else {
- attempt::stop_if_all(term, is.character, msg = "\nPlease use numeric format only.")
- if (length(term) == 1) {
- term <- sprintf("%02d", as.numeric(term))
- } else if (length(term) > 1) {
- if(isTRUE(verbose)) close(pb)
- term <- paste(sprintf("%02d", as.numeric(term)), collapse = "&")
- stop("API does not support multiple terms.")
- }
- }
-
- # Update progress bar to 40%
- if(isTRUE(verbose)) setTxtProgressBar(pb, 40)
-
- set_api_url <- paste("https://data.ly.gov.tw/odw/ID2Action.action?term=",
- term, "&sessionPeriod=",
- sprintf("%02d", as.numeric(session_period)),
- "&sessionTimes=&item=&fileType=json", sep = "")
-
- tryCatch(
- {
- # Update progress bar to 60%
- if(isTRUE(verbose)) setTxtProgressBar(pb, 60)
-
- with_options(list(timeout = max(1000, getOption("timeout"))),{
- json_df <- jsonlite::fromJSON(set_api_url)
- })
-
- # Update progress bar to 80%
- if(isTRUE(verbose)) setTxtProgressBar(pb, 80)
-
- df <- tibble::as_tibble(json_df$dataList)
- attempt::stop_if_all(nrow(df) == 0, isTRUE, msg = "Query returned no data.")
-
- # Update progress bar to 100% and show results
- if(isTRUE(verbose)) {
- setTxtProgressBar(pb, 100)
- close(pb)
- cat("\n\n")
- cat("====== Retrieved Information ======\n")
- cat("-----------------------------------\n")
- cat(" URL: \n", set_api_url, "\n")
- cat(" Term: ", term, "\n")
- if(!is.null(session_period)) {
- cat(" Session Period: ", session_period, "\n")
- }
- cat(" Total Responses: ", nrow(df), "\n")
-
- # Add session period distribution if available
- if("sessionPeriod" %in% colnames(df)) {
- session_counts <- table(df$sessionPeriod)
- cat("\nSession Distribution:\n")
- for(session in names(session_counts)) {
- cat(sprintf(" Session %s: %d\n", session, session_counts[session]))
- }
- }
- cat("===================================\n")
- }
-
- # 回傳結果
- list_data <- list(
- "title" = "Executive Response Records",
- "query_time" = Sys.time(),
- "retrieved_number" = nrow(df),
- "retrieved_term" = term,
- "url" = set_api_url,
- "variable_names" = colnames(df),
- "manual_info" = "https://data.ly.gov.tw/getds.action?id=2",
- "data" = df
- )
- return(list_data)
- },
- error = function(error_message) {
- if(isTRUE(verbose)) {
- close(pb)
- cat("\nError occurred while fetching data:\n")
- cat(sprintf("Error: %s\n", error_message))
- }
- message(error_message)
- }
- )
-}
diff --git a/.Rproj.user/763C8F27/sources/session-ab45fd2f/BA878189-contents b/.Rproj.user/763C8F27/sources/session-ab45fd2f/BA878189-contents
deleted file mode 100644
index a3ece74c..00000000
--- a/.Rproj.user/763C8F27/sources/session-ab45fd2f/BA878189-contents
+++ /dev/null
@@ -1,39 +0,0 @@
----
-title: "Party Caucus Negotiation"
-output: rmarkdown::html_vignette
-vignette: >
- %\VignetteIndexEntry{Party Caucus Negotiation}
- %\VignetteEngine{knitr::rmarkdown}
- %\VignetteEncoding{UTF-8}
----
-
-```{r, include = FALSE}
-knitr::opts_chunk$set(
- collapse = TRUE,
- comment = "#>"
-)
-```
-
-```{r include=FALSE}
-assign("has_internet_via_proxy", TRUE, environment(curl::has_internet))
-```
-
-
-## An Example of the Records of the Bills
-
-First, we'll import legisTaiwan. Next, we'll retrieve data from September 23rd in the Republic of China year 111 to January 19th in the Republic of China year 112. Unlike the date parameter in get_bills(), it needs to be formatted as a Republic of China year in a string with "/". The reason is due to inconsistencies in the API's parameter design. In the next version, 0.2 and above, we aim to overcome this issue and unify the date format within the `legisTaiwan` framework.
-
-```{r}
-library(legisTaiwan)
-```
-
-
-```{r}
-caucus_df <- get_caucus_meetings(start_date = "111/09/23", end_date = "112/01/19", verbose = FALSE)
-```
-
-
-```{r}
-caucus_df$data
-```
-
diff --git a/.Rproj.user/763C8F27/sources/session-ab45fd2f/BC739EBB-contents b/.Rproj.user/763C8F27/sources/session-ab45fd2f/BC739EBB-contents
deleted file mode 100644
index 4927fcc8..00000000
--- a/.Rproj.user/763C8F27/sources/session-ab45fd2f/BC739EBB-contents
+++ /dev/null
@@ -1,250 +0,0 @@
-#' Check Each Function's Manual
-#'
-#'@author David Liao (davidycliao@@gmail.com)
-#'
-#'@description `get_variable_info` generate each API's endpoint manual returned
-#'from the website of Taiwan Legislative Yuan. The avalaible options is: `get_bills`,
-#'`get_bills_2`, `get_meetings`, `get_caucus_meetings`, `get_speech_video` ,
-#'`get_public_debates`, `get_parlquestions`, `get_executive_response` and
-#'`get_committee_record`.
-#'
-#'@param param_ characters. Must be one of options below: \describe{
-#' \item{get_bills}{get_bills: the records of the bills, see \url{https://data.ly.gov.tw/getds.action?id=6}}
-#' \item{get_bills_2}{the records of legislators and the government proposals, see \url{https://data.ly.gov.tw/getds.action?id=6}}
-#' \item{get_meetings}{the spoken meeting records, see \url{https://www.ly.gov.tw/Pages/List.aspx?nodeid=154}}
-#' \item{get_caucus_meetings}{the meeting records of cross-caucus session, see \url{https://data.ly.gov.tw/getds.action?id=8}}
-#' \item{get_speech_video}{the full video information of meetings and committees, see \url{https://data.ly.gov.tw/getds.action?id=148}}
-#' \item{get_public_debates}{the records of national public debates, see \url{https://data.ly.gov.tw/getds.action?id=7}}
-#' \item{get_parlquestions}{the records of parliamentary questions, see \url{https://data.ly.gov.tw/getds.action?id=6}}
-#' \item{get_executive_response}{the records of the questions answered by the executives, see \url{https://data.ly.gov.tw/getds.action?id=2}}
-#'}
-#'
-#'@return list \describe{
-#' \item{`page_info`}{information of the end point}
-#' \item{`reference_url`}{the url of the page}}
-#'
-#'@details `get_variable_info` produces a list, which contains `page_info` and `reference_url`.
-#'
-#'@importFrom attempt stop_if_all
-#'@importFrom jsonlite fromJSON
-#'@importFrom rvest html_text2 read_html
-#'@importFrom tibble as_tibble
-#'
-#' @export
-#'
-#' @seealso `review_session_info()`.
-#'
-#' @examples
-#' \dontrun{
-#' get_variable_info("get_bills")
-#' }
-# get_variable_info <- function(param_) {
-# check_internet()
-# attempt::stop_if_all(website_availability(), isFALSE, msg = "the error from the API.")
-# attempt::stop_if_all(param_, is.numeric, msg = "use string format only.")
-# attempt::stop_if_all(param_, is.null, msg = "use correct funtion names.")
-# attempt::stop_if(param_ , ~ length(.x) >1, msg = "only allowed to query one function.")
-# if (param_ == "get_parlquestions") {
-# url <- "https://data.ly.gov.tw/getds.action?id=6"
-# }
-# else if (param_ == "get_legislators") {
-# url <- "https://data.ly.gov.tw/getds.action?id=16"
-# }
-# else if (param_ == "get_committee_record") {
-# url <- "https://data.ly.gov.tw/getds.action?id=46"
-# }
-# else if (param_ == "get_executive_response") {
-# url <- "https://data.ly.gov.tw/getds.action?id=2"
-# }
-# else if (param_ == "get_caucus_meetings") {
-# url <- "https://data.ly.gov.tw/getds.action?id=8"
-# }
-# else if (param_ == "get_speech_video") {
-# url <- "https://data.ly.gov.tw/getds.action?id=148"
-# }
-# else if (param_ == "get_bills_2") {
-# url <- "https://data.ly.gov.tw/getds.action?id=20"
-# }
-# else if (param_ == "get_public_debates") {
-# url <- "https://data.ly.gov.tw/getds.action?id=7"
-# }
-# else if (param_ %in% c("get_bills", "get_meetings")) {
-# if (param_ == "get_meetings") {
-# url <- "https://www.ly.gov.tw/Pages/List.aspx?nodeid=154"
-# }
-# else if (param_ == "get_bills") {
-# url <- "https://www.ly.gov.tw/Pages/List.aspx?nodeid=153"
-# }
-# html_info <- rvest::html_text2(rvest::html_nodes(rvest::html_nodes(rvest::read_html(url), "*[id='form_Query']"), "div") )
-# page_info <- list(page_info = strsplit(html_info[14], split = "\n")[[1]], reference_url = url)
-# return(page_info)
-# }
-# else {
-# stop("Use correct funtion names below in character format:
-# get_bills: the records of the bills
-# get_bills_2: the records of legislators and the government proposals
-# get_meetings: the spoken meeting records
-# get_caucus_meetings: the meeting records of cross-caucus session
-# get_speech_video: the full video information of meetings and committees
-# get_public_debates: the records of national public debates
-# get_parlquestions: the records of parliamentary questions
-# get_executive_response: the records of the questions answered by the executives")
-# }
-# html <- rvest::html_nodes(rvest::read_html(url), "*[id='content']")
-# title <- gsub("[[:space:]]", "", rvest::html_text2(rvest::html_nodes(html, "h2")))
-#
-# content <- gsub("[[:space:]]", "", rvest::html_text2(rvest::html_nodes(html, "span")))
-# df <- data.frame(content[seq(1, length(content), 2 )],
-# content[seq(1, length(content) + 1, 2 ) -1])
-# colnames(df) <- c(title[2], title[1])
-# df <- tibble::as_tibble(df)
-# page_info <- list(page_info = df, reference_url = url)
-# return(page_info)
-# }
-
-get_variable_info <- function(param_) {
- # Ensure internet and website availability
- check_internet()
- attempt::stop_if_not(website_availability(), msg = "the error from the API.")
-
- # Parameter checks
- attempt::stop_if(param_, is.numeric, msg = "use string format only.")
- attempt::stop_if(param_, is.null, msg = "use correct function names.")
- attempt::stop_if(param_, ~ length(.x) > 1, msg = "only allowed to query one function.")
-
- # Dictionary for URL mapping
- url_mapping <- list(
- get_parlquestions = "https://data.ly.gov.tw/getds.action?id=6",
- get_legislators = "https://data.ly.gov.tw/getds.action?id=16",
- get_committee_record = "https://data.ly.gov.tw/getds.action?id=46",
- get_executive_response = "https://data.ly.gov.tw/getds.action?id=2",
- get_caucus_meetings = "https://data.ly.gov.tw/getds.action?id=8",
- get_speech_video = "https://data.ly.gov.tw/getds.action?id=148",
- get_bills_2 = "https://data.ly.gov.tw/getds.action?id=20",
- get_public_debates = "https://data.ly.gov.tw/getds.action?id=7"
- )
- if (!(param_ %in% names(url_mapping) || param_ %in% c("get_bills", "get_meetings"))) {
- stop("Use correct function names below in character format:
- get_bills: the records of the bills
- get_bills_2: the records of legislators and the government proposals
- get_meetings: the spoken meeting records
- get_caucus_meetings: the meeting records of cross-caucus session
- get_speech_video: the full video information of meetings and committees
- get_public_debates: the records of national public debates
- get_parlquestions: the records of parliamentary questions
- get_executive_response: the records of the questions answered by the executives")
- }
-
-
- # Fetch URL from dictionary or process special cases
- if (param_ %in% names(url_mapping)) {
- url <- url_mapping[[param_]]
- } else if (param_ == "get_meetings") {
- url <- "https://www.ly.gov.tw/Pages/List.aspx?nodeid=154"
- } else if (param_ == "get_bills") {
- url <- "https://www.ly.gov.tw/Pages/List.aspx?nodeid=153"
- } else {
- stop("Use correct function names below in character format.")
- }
-
- if (param_ %in% c("get_bills", "get_meetings")) {
- html_info <- rvest::html_text2(rvest::html_nodes(rvest::html_nodes(rvest::read_html(url), "*[id='form_Query']"), "div"))
- page_info <- list(page_info = strsplit(html_info[14], split = "\n")[[1]], reference_url = url)
- return(page_info)
- }
-
- html <- rvest::html_nodes(rvest::read_html(url), "*[id='content']")
- title <- gsub("[[:space:]]", "", rvest::html_text2(rvest::html_nodes(html, "h2")))
-
- content <- gsub("[[:space:]]", "", rvest::html_text2(rvest::html_nodes(html, "span")))
- df <- data.frame(content[seq(1, length(content), 2)],
- content[seq(1, length(content) + 1, 2) - 1])
- colnames(df) <- c(title[2], title[1])
- df <- tibble::as_tibble(df)
- page_info <- list(page_info = df, reference_url = url)
-
- return(page_info)
-}
-
-
-#' Check Session Periods in Each Year (Minguo Calendar)
-#'
-#'@author David Liao (davidycliao@@gmail.com)
-#'
-#'@details `review_session_info` produces a dataframe, displaying each session
-#'period in year formatted in Minguo (Taiwan) calendar.
-#'
-#'@param term numeric
-#'
-#'@return dataframe
-#'
-#'@importFrom attempt stop_if_all
-#'@importFrom rvest html_text2 read_html
-#'@importFrom tibble as_tibble
-#'
-#' @seealso
-#' Regarding Minguo calendar, please see \url{https://en.wikipedia.org/wiki/Republic_of_China_calendar}.
-#'
-#' @examples
-#' \dontrun{
-#' review_session_info(7)
-#' }
-
-review_session_info <- function(term) {
- # Input validation
- if(missing(term)) {
- stop("Term parameter is required")
- }
-
- attempt::stop_if_not(website_availability2(),
- msg = "API connection error. Please check your internet connection.")
-
- attempt::stop_if(term, is.null,
- msg = "Term cannot be NULL. Please provide a valid term number (1-11).")
-
- attempt::stop_if_not(term %in% 1:11,
- msg = paste("Invalid term:", term,
- "\nPlease provide a term number between 1 and 11."))
-
- # Construct URL
- url <- sprintf("https://npl.ly.gov.tw/do/www/appDate?status=0&expire=%02d&startYear=0",
- as.numeric(term))
-
- tryCatch({
- # Parse HTML
- html_ <- rvest::html_nodes(rvest::read_html(url),
- "*[class='section_wrapper']")
-
- # Extract titles
- title <- stringr::str_split_1(
- rvest::html_text2(
- rvest::html_nodes(html_, "[class='tt_titlebar2']")
- ),
- "\t\r"
- )[1:2]
-
- # Extract rows
- odd_rows <- rvest::html_text2(
- rvest::html_nodes(html_, "[class='tt_listrow_odd']")
- )
- even_rows <- rvest::html_text2(
- rvest::html_nodes(html_, "[class='tt_listrow_even']")
- )
-
- # Process data
- data <- lapply(
- lapply(c(odd_rows, even_rows),
- function(x) stringr::str_split_1(x, "\r\r")),
- function(x) gsub("[[:space:]]", "", x)
- )
-
- # Create dataframe
- df <- do.call(rbind, data)
- colnames(df) <- title
-
- return(tibble::as_tibble(df))
- },
- error = function(e) {
- stop(paste("Error retrieving session information:", e$message))
- })
-}
diff --git a/.Rproj.user/763C8F27/sources/session-ab45fd2f/BD4EC996-contents b/.Rproj.user/763C8F27/sources/session-ab45fd2f/BD4EC996-contents
deleted file mode 100644
index 683cb8e0..00000000
--- a/.Rproj.user/763C8F27/sources/session-ab45fd2f/BD4EC996-contents
+++ /dev/null
@@ -1,147 +0,0 @@
----
-title: "The Records of the Bills"
-author: ""
-output: rmarkdown::html_vignette
-vignette: >
- %\VignetteIndexEntry{The Records of the Bills}
- %\VignetteEngine{knitr::rmarkdown}
- %\VignetteEncoding{UTF-8}
----
-
-```{r, include = FALSE}
-knitr::opts_chunk$set(
- collapse = TRUE,
- comment = "#>"
-)
-```
-
-```{r include=FALSE}
-assign("has_internet_via_proxy", TRUE, environment(curl::has_internet))
-```
-
-
-## An Example of the Records of the Bills
-
-
-This section demonstrates how to fetch and analyze legislative bills data from Taiwan's parliament using the legisTaiwan package. We'll explore two different methods of retrieving bill data using specific date ranges and legislative terms.
-
-
-
-```{r}
-library(legisTaiwan)
-```
-
-
-
-First, we'll fetch bills within a specific date range. Note that the dates use the Republic of China (ROC) calendar system:
-
-- Start date: 106/01/20 (ROC calendar)
-- End date: 111/03/10 (ROC calendar)
-
-
-
-```{r}
-billdata <- get_bills(start_date = 1030120,end_date = 1110310, verbose = TRUE)
-```
-
-
-
-The get_bills() function returns a comprehensive list containing the metadata and the actual bill data:
-
-
-
-
-```{r}
-str(billdata, give.attr = FALSE)
-```
-
-
-`billdata` is a list containing 12 elements:
-
-- `$title` "the records of bill sponsor and co-sponsor"
-- `$query_time`: imestamp of when the data was retrieved
-- `$retrieved_number`: Total number of records retrieved
-- `$proposer`: Filter condition for bill proposers
-- `$start_date_ad` and `end_date_ad`:
-- `$url`: source API URL for the data
-- `$variable_names`: List of column names in the dataset
-- `$manual_info`: Link to official documentation page
-- `$data`: tibble [12,519 × 9]
-
-`billdata$data` returns tibble table containing relevent information.
-
-```{r}
-billdata$data
-```
-
-
-- `query_time`: When the data was retrieved
-- `retrieved_number`: Number of records fetched
-- `meeting_unit`: Legislative unit information
-- `start_date_ad/end_date_ad`: Dates in Western calendar
-- `start_date/end_date`: Dates in ROC calendar
-- `url`: Source URL
-- `variable_names`: Column names in the dataset
-- `manual_info`: Additional documentation
-- `data`: The actual bill records
-
-
-Alternatively, you can fetch bills by legislative term using `get_bills_2()`:
-
-```{r}
-full_term <- get_bills_2(term = 11)
-full_term
-```
-
-
-This retrieves all bills from the specified legislative term (in this case, the 11th term), providing a convenient way to analyze legislative activities within specific parliamentary periods.
-
-
-The returned data includes detailed information about each bill, such as:
-
-- Bill status and progress
-- Sponsoring legislators
-- Committee referrals
-- Dates of various legislative actions
-- Bill content and explanatory notes
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/.Rproj.user/763C8F27/sources/session-ab45fd2f/BF1F030F-contents b/.Rproj.user/763C8F27/sources/session-ab45fd2f/BF1F030F-contents
deleted file mode 100644
index a22753d9..00000000
--- a/.Rproj.user/763C8F27/sources/session-ab45fd2f/BF1F030F-contents
+++ /dev/null
@@ -1,251 +0,0 @@
-#' Clean legislator names
-#'
-#' @keywords internal
-#' @noRd
-.clean_names <- function(x) {
- names <- x |>
- gsub("本院委員", "", .) |>
- gsub("委員", "", .) |>
- gsub("等\\s*\\d+\\s*人", "", .) |>
- gsub("等\\d+人", "", .) |>
- gsub("等", "", .) |>
- gsub("\\s+", "", .) |>
- gsub("本院", "", .) |>
- trimws()
-
- return(names)
-}
-
-
-#' Validate Date Formats
-#'
-#' This function checks if the provided start and end dates are in the correct numeric format.
-#'
-#' @param start_date A string representing the start date. Expected format is numeric, e.g., "1090101".
-#' @param end_date A string representing the end date. Expected format is numeric, e.g., "1090101".
-#' @return NULL. If the dates are not in the expected format, an error is thrown.
-#' @examples
-#' # This should throw an error:
-#' \dontrun{
-#' validate_dates_format("10901", "1100101")
-#' }
-#' @keywords internal
-validate_dates_format <- function(start_date, end_date) {
- valid_date_format <- function(date) {
- return(grepl("^\\d{7}$", date))
- }
-
- if (!valid_date_format(start_date) || !valid_date_format(end_date)) {
- stop("Dates should be in numeric format. E.g., 1090101.")
- }
-}
-
-
-#' Check for the Website Availability I
-#'
-#' This function checks the availability of a specified website by trying to read
-#' the first line of the site's content.
-#'
-#' @param site A website URL to check. Default is "https://data.ly.gov.tw/index.action".
-#'
-#' @seealso
-#' `check_internet()`
-#'
-#' @keywords internal
-website_availability <- function(site = "https://data.ly.gov.tw/index.action") {
- tryCatch({
- readLines(site, n = 1)
- TRUE
- },
- warning = function(w) invokeRestart("muffleWarning"),
- error = function(e) FALSE)
-}
-
-#' Check for the Website Availability II
-#'
-#' This function checks the availability of a specified website by trying to read
-#' the first line of the site's content.
-#'
-#' @param site A website URL to check. Default is "https://npl.ly.gov.tw/do/www/appDate?status=0&expire=02&startYear=0".
-#'
-#' @keywords internal
-#' @seealso `check_internet()` and `website_availability()`.
-website_availability2 <- function(site = "https://npl.ly.gov.tw/do/www/appDate?status=0&expire=02&startYear=0") {
- tryCatch({
- readLines(site, n = 1)
- TRUE
- },
- warning = function(w) invokeRestart("muffleWarning"),
- error = function(e) FALSE)
-}
-
-
-
-#' A Check for Internet Connectivity.
-#'
-#'@param x The default value is `curl::has_internet()`, which activate the
-#'internet connectivity check.
-#'
-#'@importFrom attempt stop_if_not
-#'
-#'@importFrom curl has_internet
-#'
-#'@keywords internal
-check_internet <- function(x = curl::has_internet()) {
- attempt::stop_if_not(.x = x,
- msg = "Please check the internet connection")
-}
-
-#' A General Check for Taiwan Legislative Yuan API
-#'
-#'@param start_date start_date is inherited from global env.
-#'
-#'@param end_date end_date is inherited from global env.
-#'
-#'@importFrom attempt stop_if_not
-#'@keywords internal
-# api_check <- function(start_date = start_date, end_date = end_date) {
-# attempt::stop_if_all(start_date > as.Date(Sys.time()),
-# isTRUE, msg = "The start date should not be after the system time")
-# attempt::stop_if_all(end_date > as.Date(Sys.time()),
-# isTRUE, msg = "The end date should not be after the system time")
-# attempt::stop_if_all(start_date, is.character, msg = "use numeric format")
-# attempt::stop_if_all(end_date, is.character, msg = "use numeric format")
-# attempt::stop_if_all(start_date, is.null, msg = "start_date is missing")
-# attempt::stop_if_all(end_date, is.null, msg = "end_date is missing")
-# attempt::stop_if_all(end_date > start_date, isFALSE,
-# msg = paste("The start date, ", start_date, ",", " should not be later than the end date, ",
-# end_date, ".", sep = ""))
-# }
-api_check <- function(start_date = start_date, end_date = end_date) {
-
- attempt::stop_if_all(start_date > as.Date(Sys.time()),
- isTRUE, msg = "The start date should not be after the current system time.")
- attempt::stop_if_all(end_date > as.Date(Sys.time()),
- isTRUE, msg = "The end date should not be after the current system time.")
- attempt::stop_if_all(start_date, is.character,
- msg = "Use numeric format for start_date.")
- attempt::stop_if_all(end_date, is.character,
- msg = "Use numeric format for end_date.")
- attempt::stop_if_all(start_date, is.null,
- msg = "The parameter 'start_date' is missing.")
- attempt::stop_if_all(end_date, is.null,
- msg = "The parameter 'end_date' is missing.")
- attempt::stop_if_all(end_date > start_date, isFALSE,
- msg = paste("The start date, ", start_date, ",", " should not be later than the end date, ",
- end_date, ".", sep = ""))
-}
-
-
-#' Transforming Minguo (Taiwan) Calendar to A.D. Calendar I
-#'
-#' @description `transformed_date_meeting()` transforms Minguo (Taiwan) Calendar
-#' to A.D. calendar in POSIXct for `get_meetings()`, `get_caucus_meetings()`,
-#' and `get_speech_video()`,
-#'
-#' @param roc_date Date format in Minguo (Taiwan) calendar (e.g., "105/05/31") as a
-#' string vector
-#'
-#' @return date in POSIXct
-#'
-#' @importFrom stringr str_split_1
-#'
-#' @keywords internal
-#'
-#' @examples
-#' \dontrun{
-#' transformed_date_meeting("105/05/31")
-#' }
-#'
-#' @details `check_date` transforms ROC date to a date in POSIXct, e.g. "105/05/31" to "2016-05-31".
-transformed_date_meeting <- function(roc_date) {
- roc_date <- stringr::str_split_1(roc_date, "/")
- date_ad <- as.Date(as.POSIXct(paste(as.numeric(roc_date[1]) + 1911,
- roc_date[2],
- roc_date[3], sep = "-"),
- origin = "1582-10-14", tz = "GMT"))
- return(date_ad)
-}
-
-
-#' Transforming Minguo (Taiwan) Calendar to A.D. Calendar II
-#'
-#' @description `transformed_date_meeting()` transforms Minguo (Taiwan) Calendar
-#' to A.D. format in POSIXct for `get_bill()`, e.g. "1050531" to "2016-05-31".
-#'
-#' @param roc_date date format in Taiwan ROC calendar (e.g., "1050531") in a character vector
-#'
-#' @return date in POSIXct
-#'
-#' @importFrom stringr str_sub
-#'
-#' @keywords internal
-#'
-#' @examples
-#' \dontrun{
-#' transformed_date_bill("1050531")
-#' }
-transformed_date_bill <- function(roc_date) {
- day <- stringr::str_sub(roc_date, -2, -1)
- month <- stringr::str_sub(roc_date, -4, -3)
- roc_year <- stringr::str_sub(roc_date, 1, nchar(roc_date) - nchar(stringr::str_sub(roc_date, -4, -1)))
- date_ad <- as.Date(as.POSIXct(paste(as.numeric(roc_year) + 1911,
- as.numeric(month),
- as.numeric(day), sep = "-"),
- origin = "1582-10-14", tz = "GMT"))
- return(date_ad)
-}
-
-#' Transforming Minguo (Taiwan) Calendar to A.D. Calendar III
-#'
-#'@description `transformed_date_meeting()` transforms Minguo (Taiwan) Calendar
-#'to A.D. format in POSIXct for `get_bill()`, e.g. "1050531" to "2016-05-31".
-#'
-#'@param roc_date date format in Minguo (Taiwan) Calendar (e.g., "1050531") in a
-#'character vector
-#'
-#'@return date in POSIXct
-#'
-#'@importFrom stringr str_sub
-#'
-#'@keywords internal
-check_date <- function(roc_date) {
- day <- stringr::str_sub(roc_date, -2, -1)
- month <- stringr::str_sub(roc_date, -4, -3)
- roc_year <- stringr::str_sub(roc_date, 1, nchar(roc_date) - nchar(stringr::str_sub(roc_date, -4, -1)))
- date_ad <- as.Date(as.POSIXct(paste(as.numeric(roc_year) + 1911,
- as.numeric(month),
- as.numeric(day), sep = "-"),
- origin = "1582-10-14", tz = "GMT"))
- return(date_ad)
-}
-
-
-#' Transforming Minguo (Taiwan) Calendar to A.D. Calendar IIII
-#'
-#'@description `transformed_date_meeting()` transforms Minguo (Taiwan) Calendar
-#'to A.D. format in POSIXct for `get_bill()`, e.g. "1050531" to "2016-05-31".
-#'
-#'@param roc_date Date format in Minguo (Taiwan) calendar (e.g., "105/05/31") as a
-#'string vector
-#'
-#'@return date in POSIXct
-#'
-#'@importFrom stringr str_split_1
-#'
-#'@keywords internal
-#'
-#' @examples
-#' \dontrun{
-#' check_date2("105/05/31")
-#' }
-#'
-#'@details `check_date` transforms ROC date to a date in POSIXct, e.g. "105/05/31" to "2016-05-31".
-check_date2 <- function(roc_date) {
- roc_date <- stringr::str_split_1(roc_date, "/")
- date_ad <- as.Date(as.POSIXct(paste(as.numeric(roc_date[1]) + 1911,
- roc_date[2],
- roc_date[3], sep = "-"),
- origin = "1582-10-14", tz = "GMT"))
- return(date_ad)
-}
diff --git a/.Rproj.user/763C8F27/sources/session-ab45fd2f/C0644538-contents b/.Rproj.user/763C8F27/sources/session-ab45fd2f/C0644538-contents
deleted file mode 100644
index d944ad0f..00000000
--- a/.Rproj.user/763C8F27/sources/session-ab45fd2f/C0644538-contents
+++ /dev/null
@@ -1,5162 +0,0 @@
-的
-把你們
-對你們
-你們自己
-您
-把您
-之
-為
-對您
-您自己
-並
-以
-任
-應
-於
-不
-已行
-鑑於
-日前
-並
-未予
-諸多
-等
-其
-但
-情事
-其
-您們
-未將
-但
-遭
-是
-卻
-爰
-把您們
-對您們
-您們自己
-特向
-他
-把他
-對他
-他自己
-她
-把她
-對她
-她自己
-牠
-把牠
-對牠
-牠自己
-它
-把它
-對它
-它自己
-你們
-把你們
-對你們
-你們自己
-這
-那
-這些
-那些
-該
-這個
-這麼
-這樣
-這是
-我的
-我們的
-你的
-你們的
-他的
-她的
-牠的
-它的
-他們的
-其
-甚麼
-什麼
-哪一
-那一
-哪一個
-那一個
-哪個
-那個
-誰
-誰人
-誰人的
-哪時
-那時
-何時
-幾時
-哪裡
-那裡
-哪裏
-那裏
-哪兒
-那兒
-如何
-為何
-怎樣
-何方
-是
-有
-擁有
-確有
-可能
-應該
-將會
-或能
-未必
-似乎
-說
-表示
-講
-提出
-透露
-陳述
-講述
-報道
-報導
-報告
-匯報
-和
-與
-及
-以及
-兼
-並
-但
-但是
-然而
-而
-而是
-而且
-不過
-如果
-如
-若果
-若
-即使
-假如
-或者
-或
-或是
-還是
-抑或
-換言之
-換句話說
-當時
-也沒有
-也不
-因為
-因
-由於
-所以
-那樣
-那麼
-正是
-同樣地
-大概
-跟
-像
-都很
-直至
-直到
-迄
-曾經
-一度
-以前
-從前
-這地
-這處
-這地方
-這個地方
-那地
-那處
-那地方
-那個地方
-全部
-所有
-完全
-共
-每一
-任何
-都
-皆
-兩者都
-均
-各自
-個別
-彼此
-亦
-少量
-少數
-少
-多
-多數
-大量
-更多
-更大量
-更
-最多
-大多數
-大部份
-最
-極
-極其
-幾乎
-一些
-若干
-部份
-其他
-其餘
-個別
-剩餘
-如此
-如
-因此
-固此
-不
-不是
-非
-否
-沒
-只是
-只
-那末
-那麼
-然後
-也
-太
-過於
-非常
-很
-頗
-的
-屬於
-於
-屬
-之中
-之內
-入
-在
-由
-至
-到
-內
-裡面
-裏面
-給
-為了
-為
-作為
-就
-和
-跟隨
-同
-以
-有
-關於
-對於
-至於
-反對
-對立
-倚
-靠
-關於
-有關
-涉及
-之間
-中間
-期間
-進入
-成為
-轉為
-朝著
-朝着
-通過
-穿越
-由於
-透過
-經
-中
-其中
-前
-之前
-後
-之後
-其後
-上
-之上
-其上
-下
-之下
-其下
-向上
-向下
-在上
-在下
-往上
-往下
-之中
-之外
-其外
-處於
-離
-遠離
-我
-掉
-去掉
-除
-除掉
-靠近
-覆蓋
-過
-我
-從
-多於
-超過
-高於
-根據
-受
-外
-自
-始於
-以防
-以免
-朝
-向
-往
-前往
-對著
-對着
-對
-給
-距
-到
-至
-差
-令
-又
-又一
-再一次
-再
-復
-屢
-更
-進一步
-之外
-此外
-比
-自己的
-獨立地
-獨立的
-本人的
-相同
-同樣
-相同的
-同樣的
-分
-時
-日
-月
-年
-年代
-年份
-年度
-世紀
-早上
-上午
-晚上
-下午
-中午
-為
-並
-等
-多
-
-這部分
-書面報告
-月份
-國內
-什麼樣
-困難
-辛苦
-主管機關
-金額
-講到
-一條
-好嗎
-原則
-注意
-上次
-反對
-兩年
-了嗎
-你講
-放在
-要問
-幾年
-一個月
-好嗎
-還在
-這方面
-實際上
-這件
-一次
-兩個
-我要
-第一個
-幾個
-很大
-再來
-講的
-一年
-第二個
-事實上
-減少
-一件
-是從
-這也
-提高
-目的
-三個
-地區
-有人
-情形
- ok
-多久
-一種
-法治
-佩服
-披露
-分鐘
-關注
-含有
-朝野
-研議
-黨團
-現象
-草案
-審理
-案件
-萬戶
-第三款
-第二款
-本法
-刪除
-入法
-這條
-第十三條
-放進來
-第四項
-所提
-前項
-第四款
-第十六條
-罰則
-要點
-倡議
-值得
-活動
-之內
-擔任
-背景
-議員
-年前
-一邊
-時空
-經歷
-時代
-十幾年
-正面
-人有
-固定
-卡住
-某種程度
-挑戰
-教育部
-教育
-違反
-質疑
-改善
-鼓勵
-成立
-活動
-實話
-成效
-指標
-達成
-效益
-效果
-會要
-評比
-不彰
-成績
-相比
-五成
-四成
-低於
-六成
-相較
-看不到
-表格
-考核
-會來
-上路
-國際
-年限
-可能性
-涵蓋到
-避免掉
-公司
-呈現
-開放
-表達
-活動
-頻率
-權益
-改善
-申訴
-移除
-預計
-訊息
-原本
-完整
-持續
-分析
-試辦
-確認
-利用
-協助
-落實
-一併
-釐清
-提升
-落實
-釐清
-國外
-服務
-協助
-面臨
-推進
-突破
-角色
-新增
-採取
-產業
-企業
-明年
-立法
-第一線
-程序
-涉及到
-就教
-照顧
-對象
-風險
-配套
-也許
-結束
-期待
-接近
-差異
-關切
-講白
-情勢
-預期
-垂詢
-歷史
-在一起
-員工
-後續
-實話
-平臺
-給予
-角度
-業者
-設置
-想法
-接近
-麻煩
-法制
-實話
-有限
-感謝
-報備
-變更
-建請
-爬梳
-核定
-譬如說
-第幾
-初步
-顯示
-no
-提早
-不應該
-外面
-不然
-清清楚楚
-萬一
-廢掉
-改為
-爆發
-對了
-一點點
-假設
-第一百六十五
-任內
-其餘
-形同
-一致
-統統
-談到
-僅有
-作出
-幹什麼
-像是
-理想
-不到
-三成
-第四
-有無
-點出
-左邊
-旁邊
-養成
-尚未
-得以
-單一
-現況
-實施
-階段
-正確
-占用
-背後
-詢問
-選擇
-進到
-認不
-不等
-力道
-宣傳
-核心
-一但
-三分之一
-推給
-得以
-促使
-一旦
-形同
-希望
-儘快
-國人
-檢討
-概括
-推展
-回應
-需求
-之間
-前天
-四十多
-幾十
-原因
-拿掉
-不一定
-不錯
-等一下
-認定
-牽扯到
-還可以
-平常
-副部長
-送到
-數據
-贊成
-委員長
-官員
-怎麼辦
-注意到
-參加
-不然
-考量
-平常
-世界
-能力
-例子
-不好
-好幾
-平常
-重點
-好了
-奇怪
-說清楚
-不好意思
-動議
-慢慢
-期間
-評估
-負責
-因應
-配合
-透過
-思考
-原因
-之外
-規劃
-保護
-東西
-沒辦法
-搞不好
-立場
-看法
-明定
-早上
-放心
-百分之百
-列席
-能不能
-動作
-東西
-因應
-碰到
-成果
-力量
-交給
-百分之
-體系
-關係
-績效
-承受
-投資
-努力
-胡說八道
-提醒
-合作
-一般
-盤點
-建立
-情況
-怎麼樣
-流程
-sop
-即時
-回報
-疑似
-裡頭
-強化
-思維
-分享
-面向
-永續
-新興
-論述
-實踐
-投入
-學習
-關鍵
-民間
-聚焦
-最新
-一頁
-三千多
-幾億元
-花錢
-三百多
-一百多
-五千
-年時
-早就
-有錢
-兩千多
-二級
-一級
-四級
-等級
-同一個
-列為
-姓名
-三次
-第一級
-討論一下
-編號
-一毛錢
-測試
-第二階段
-第一階段
-一套
-五個
-四大
-面向
-五大
-第四個
-失敗
-法源
-規則
-命令
-制定
-預告
-修訂
-遵守
-指引
-準則
-函釋
-放寬
-可行
-修改
-算不算
-困擾
-多少錢
-這段
-度過
-所提
-模糊
-現有
-放到
-適度
-回歸到
-做過
-幾位
-不太
-前提
-提過
-不算
-徵詢
-引發
-備查
-空白
-修改
-完備
-表格
-做過
-幾項
-浪費
-退回
-六個
-三項
-第三階段
-多月
-出錢
-六百多
-拿來
-四百多
-估算
-九百多
-億多
-老百姓
-客氣
-老實
-一遍
-聽不懂
-坐在
-再講
-長官
-講完
-生氣
-喜歡
-講過
-不讓
-欺負
-哪有
-樣子
-嘴巴
-多億元
-時代
-打造
-裡頭
-不見
-速度
-時代
-團隊
-成功
-效率
-挑戰
-快速
-加快
-腳步
-加油
-太慢
-有效率
-這段
-期許
-成績
-跟上
-展現
-魄力
-一律
-第二十三條
-愈來愈
-印象
-處置
-還會
-追蹤
-日才
-一套
-日到
-小心
-關掉
-謹慎
-請教部長
-知不知道
-可不可以
-面對
-預算
-做好
-面對
-卻是
-講過
-為例
-控管
-緊張
-離譜
-憂心
-應對
-行政部門
-難過
-全力支持
-害怕
-恐慌
-還好
-恐怖
-全世界
-好不容易
-這回
-地氣
-功課
-嚴肅
-了解
-瞭解
-不用
-坦白
-管理
-設立
-類型
-分類
-型態
-兩種
-區分
-樣態
-類別
-層次
-分成
-一類
-現有
-三種
-找到
-強度
-衝突
-簡單
-案子
-組織
-學者
-邀請
-專家學者
-諮詢
-人士
-開過
-出席
-幾位
-對話
-各方
-先進
-在場
-蒐集
-這場
-責任
-會議
-機制
-種種
-好不好
-基金
-業務
-影響
-一些
-召委
-概念
-人數
-民眾
-一直
-文化
-質詢
-老師
-期程
-有沒有
-資源
-特別
-理解
-目標
-包括
-數字
-解決
-解釋
-去年
-人才
-委員會
-法律
-費用
-請教
-同仁
-告訴
-方法
-小時
-承諾
-事件
-作業
-關心
-網站
-項目
-監督
-哪裡
-機構
-方案
-經費
-中央
-廣告
-特聘
-舉辦
-公開
-連結
-提供給
-教學
-設計
-蔣乃辛
-設計成
-職司
-凸顯出來
-字體
-顯現
-拉扯
-星期六
-評定
-拆開
-北區
-折衷
-壓縮
-正反
-廣場
-推動到
-美感
-評鑑
-身兼
-創新
-瀏覽
-標的
-提撥
-派員
-信用
-重頭戲
-總機
-瀏覽量
-開放型
-財務
-後年
-模擬
-擔子
-中段班
-掛名
-規模
-細目
-登記
-酌凍
-報紙
-儘量
-理論
-予以
-壓力
-詳細
-保留
-既有
-變化
-提供給
-精進
-實務
-做為
-課發
-經費
-經驗
-大幅
-會期
-辦公室
-會不會
-調整
-事實
-資產
-收據
-承辦人
-帶隊
-簡短
-列入
-人次
-那麼多
-第二
-點半
-解釋
-窗口
-修復
-何況
-開發
-考察
-簡化
-即可
-多麼
-透明
-信任
-太少
-一點
-背負
-史無前例
-一共
-負擔
-發言
-整理
-藉著
-專家
-未及
-源於
-囿於
-平民
-答請
-百姓
-快答
-請教
-捫心自問
-質詢部長
-辯論
-新一代
-會場
-放棄
-鄉親
-難處
-打開
-附帶
-漂亮
-提出來
-規格
-指示
-機器
-考察
-終於
-位置
-心情
-說到
-那裡
-細節
-沒關係
-立法院
-發現
-監督
-回到
-關心
-第三
-第六十四
-出售
-盜賣
-擾亂
-席方
-跟進
-張數
-席謹
-上百萬
-高中
-光榮
-接受到
-專精
-披上
-外界
-哪裡
-專案型
-外部
-受罰
-惡言
-生產
-批准
-依賴
-同仁
-費用
-增額
-收到
-席實
-發動權
-太多
-統合到
-元年
-過往
-媒合
-納入
-雞湯
-法條
-打平
-上口
-急切
-眼花
-倒退
-排行榜
-群體
-密語
-事物
-品項
-準備好
-詢問到
-小組
-危險
-副校長
-改革
-評決
-趕工
-專章
-調閱
-星期五
-之所在
-本份
-因素
-嫻熟
-標註
-規範到
-打平
-利益
-例外
-職缺
-條件
-設計
-方便度
-團體
-人力
-名片
-工廠
-發源地
-依法
-養出
-經濟
-片段
-煩惱
-子產業
-技術
-太空
-養菜蟲
-升格
-核備
-決心
-區分出來
-中央
-名稱
-期程
-有沒有
-資源
-特別
-理解
-目標
-委辦
-手段
-用以
-一口氣
-五千多
-風波
-充份
-萬言書
-動用到
-六千多萬
-改成
-下午
-揭露出來
-不出
-錯亂
-阻擋
-翻轉
-點點
-場面
-無意義
-打算
-不然
-最終
-免於
-說法
-接到
-改成
-在座
-一審
-基礎
-深深
-分區
-挑出
-總共
-放進去
-ok
-不然
-至少
-十幾
-結論
-作法
-所有人
-處理好
-彈性
-適合
-擔心
-溝通
-訂定
-朋友
-回來
-暴力
-機會
-撐過來
-民國
-比例
-定義
-幹嘛
-說出來
-不可能
-不好
-習慣
-第五
-扯後腿
-漠視
-刁難
-無能
-包含
-產品
-認定為
-回去
-協調
-不可以
-辦理
-辦過
-辦理
-好處
-儘速
-聲音
-及早
-副主委
-探討
-接受
-程度
-操作
-現實
-統合
-年費
-稱讚
-拜託
-週期
-
-承辦
-核銷
-更新
-查核
-補充
-迫切性
-重跑
-緣故
-第二
-必要性
-不厭其煩
-診斷
-點半
-輔助
-繁瑣
-落後
-請求
-篇幅
-務必
-資訊
-俾利
-沈積
-當初
-設計出來
-細瑣
-整體
-取消
-繞到
-帳棚
-筆劃
-訪客
-收銀
-擁有
-基準
-規劃好
-
-啟動
-措施
-日期
-精熟
-催促
-開啟
-升等
-裁示
-時效
-兩難
-在地
-公文
-做成
-責備錯
-右下角
-閱報
-文案
-聯展
-傳聲筒
-方式
-確實
-修正
-申請
-資訊
-實驗
-這麼多
-決議
-代表
-機會
-發展
-調查
-回答
-想要
-書面
-建設
-改變
-通案
-配置
-第十五
-處長
-解凍
-許久
-建議
-臨時
-參考
-邏輯
-保存
-檢核
-台灣
-改進
-請問
-你我
-學生
-臺灣
-裡面
-執行
-更多
-標準
-人員
-機關
-現場
-拿出來
-乘以
-不行
-明明
-double
-相關
-主管
-建議
-推動
-謝謝
-生活
-國民
-文字
-尊嚴
-福利
-條文
-符合
-人性
-第十六
-比率
-越來越
-系統
-足夠
-提供
-現行
-保障
-論點
-1.0
-0.8
-0.6
-0.4
-0.2
-0.0
-告知
-單位
-複雜
-賣給
-合約
-議題
-文件
-實在
-公布
-過程
-修法
-實質
-案例
-膨脹
-電郵
-執掌
-審議
-鬼打牆
-我國
-物力
-明白
-環境
-1.0
-0.8
-0.6
-0.4
-0.2
-0.0
-原地
-內容
-專業
-條例
-爭議
-參與
-挫敗
-雨露均霑
-男生
-領域
-行政院
-男性
-健全
-法令
-禮拜
-法規
-1.0
-0.8
-0.6
-0.4
-0.2
-0.0
-編列
-補助
-提案
-我覺
-這裡
-社會
-增加
-同意
-工作
-億元
-委員
-政策
-提到
-一定
-意見
-辦法
-主席
-國家
-地方
-中心
-發生
-狀況
-報告
-制度
-第一
-主委
-真的
-研究
-一樣
-支持
-資料
-一下
-事情
-萬元
-態度
-審查
-政府
-未來
-方向
-時間
-協會
-版本
-我們
-這個
-可以
-所以
-部長
-就是
-部分
-問題
-這樣
-其實
-一個
-因為
-如果
-本席
-大家
-什麼
-計畫
-應該
-今天
-你們
-現在
-但是
-討論
-這是
-提出
-認為
-非常
-剛剛
-一
-好像
-昨天
-等於
-拿到
-這樣子
-要不要
-大部分
-不能夠
-立委
-算是
-涉及
-好好
-到時候
-曉得
-觀念
-事項
-列出
-一方面
-之下
-一一
-反正
-各式各樣
-聽到
-立法委員
-本來
-感覺
-一半
-列出來
-形容詞
-超過
-聽起來
-有時候
-院長
-署長
-部長
-次長
-司長
-局長
-副局長
-一起
-行政
-問到
-導致
-一陣子
-部會
-
-!
-"
-#
-$
-%
-&
-'
-(
-)
-*
-+
-,
--
---
-.
-..
-...
-......
-...................
-./
-.壹
-.數
-.日
-/
-//
-\n
-0
-1
-2
-3
-4
-5
-6
-7
-8
-9
-:
-://
-::
-;
-<
-=
->
->>
-?
-@
-A
-Lex
-[
-\
-]
-^
-_
-`
-exp
-sub
-sup
-|
-}
-~
-~~~~
-·
-×
-×××
-Δ
-Ψ
-γ
-μ
-φ
-φ.
-В
-—
-——
-———
-‘
-’
-’‘
-“
-”
-”,
-…
-……
-…………………………………………………③
-′∈
-′|
-℃
-Ⅲ
-↑
-→
-∈[
-∪φ∈
-≈
-①
-②
-②c
-③
-③]
-④
-⑤
-⑥
-⑦
-⑧
-⑨
-⑩
-──
-■
-▲
-●
-✩
-★
-✦
-▀
-▁
-▂
-▃
-▄
-▅
-▆
-▇
-█
-▉
-▊
-▋
-▋
-▌
-▍
-▎
-▏
-▐
-░
-▒
-▓
-▔
-□
-▢
-▣
-▤
-▥
-▦
-▧
-▨
-▩
-▪
-▫
-▬
-▭
-▮
-▯
-▰
-▱
-◆
-◇
-◈
-◘
-◙
-◚
-◛
-◧
-◨
-◩
-◪
-◫
-⭔
-⭓
-◊
-▖
-▗
-▘
-▙
-▚
-▛
-▜
-▝
-▞
-▟
-◰
-◱
-◲
-◳
-↕
-↖
-↗
-↘
-↙
-↚
-↛
-↜
-↝
-↞
-↟
-↠
-↡
-↢
-↣
-↤
-↥
-↦
-↧
-↨
-↩
-↪
-↫
-↬
-↭
-↮
-↯
-↰
-↱
-↲
-↳
-↴
-↶
-↷
-↸
-↹
-↺
-↻
-⟳
-↼
-↽
-↾
-↿
-⇀
-⇁
-⇂
-⇃
-⇄
-⇅
-⇆
-⇇
-⇈
-⇉
-⇊
-⇋
-⇌
-⇍
-⇎
-⇏
-⇕
-⇖
-⇗
-⇘
-⇙
-⇚
-⇛
-⇜
-⇝
-⇞
-⇟
-⇠
-⇡
-⇢
-⇣
-⇤
-⇥
-⇦
-⇧
-⇨
-⇩
-⇪
-⌅
-⌆
-⌤
-⏎
-▶
-☇
-☈
-➔
-➘
-➙
-➚
-➛
-➜
-➝
-➞
-➟
-➠
-➡
-➢
-➣
-➤
-➥
-➦
-➧
-➨
-➩
-➪
-➫
-➬
-➭
-➮
-➯
-➱
-➲
-➳
-➴
-➵
-➶
-➷
-➸
-➹
-➺
-➻
-➼
-➽
-➾
-⤴
-⤵
-↵
-↓
-↔
-←
-→
-↑
-⍇
-⍈
-⍐
-⍗
-⇫
-⇬
-⇭
-⇮
-⇯
-⇰
-⇱
-⇲
-⇳
-⇴
-⇵
-⇶
-⇷
-⇸
-⇹
-⇺
-⇻
-⇼
-⇽
-⇾
-⇿
-⇐
-⇑
-⇒
-⇓
-⇔
-➡
-⬅
-⬇
-⬆
-↖
-↙
-↘
-↗
-🔄
-🔀
-↔
-↕
-⤴
-🔃
-↩
-↪
-◀
-▶
-🔁
-⤵
-⏬
-⏫
-🔽
-🔼
-👉
-👈
-👇
-👆
-⊿
-▲
-△
-▴
-▵
-▶
-▷
-▸
-▹
-►
-▻
-▼
-▽
-▾
-▿
-◀
-◁
-◂
-◃
-◄
-◅
-◢
-◣
-◤
-◥
-◬
-◭
-◮
-◸
-◹
-◺
-◿
-∇
-∆
-ˍ
-‐
-⎯
-‒
-―
-─
-━
-│
-┃
-┄
-┅
-┆
-┇
-┈
-┉
-┊
-┋
-╌
-╍
-╎
-╴
-╵
-╶
-╷
-╸
-╹
-╺
-╻
-╼
-╽
-╾
-╿
-▏
-▕
-╏
-–
-—
-⌜
-⌝
-⌞
-⌟
-┌
-┍
-┎
-┏
-┐
-┑
-┒
-┓
-└
-└
-┕
-┖
-┗
-┘
-┙
-┚
-┛
-├
-├
-┝
-┞
-┟
-┠
-┡
-┢
-┣
-┤
-┥
-┦
-┧
-┨
-┩
-┪
-┫
-┬
-┭
-┮
-┯
-┰
-┱
-┲
-┳
-┴
-┵
-┶
-┷
-┸
-┹
-┺
-┻
-┼
-┽
-┾
-┿
-╀
-╁
-╂
-╃
-╄
-╅
-╆
-╇
-╈
-╉
-╊
-╋
-═
-║
-╒
-╓
-╔
-╔
-╔
-╕
-╕
-╖
-╖
-╗
-╗
-╘
-╙
-╚
-╚
-╛
-╛
-╜
-╜
-╝
-╝
-╞
-╟
-╟
-╠
-╡
-╡
-╢
-╢
-╣
-╣
-╤
-╤
-╥
-╥
-╦
-╦
-╧
-╧
-╨
-╨
-╩
-╩
-╪
-╪
-╫
-╬
-╱
-╲
-╳
-╭
-╮
-╯
-╰
-◜
-◝
-◞
-◟
-◠
-◡
-⌈
-⌊
-⌉
-⌋
-⎛
-⎝
-⎞
-⎠
-⎡
-⎣
-⎤
-⎦
-⎧
-⎩
-⎫
-⎭
-⎸
-⎹
-⎾
-⎿
-⏉
-⏊
-⏋
-⏌
-≡
-≣
-☰
-☱
-☲
-☳
-☴
-☵
-☶
-☷
-⊖
-⊘
-⊙
-⊚
-⊛
-⊜
-⊝
-◉
-○
-◌
-◍
-◎
-●
-◐
-◑
-◒
-◓
-◔
-◕
-◖
-◗
-◦
-◯
-◴
-◵
-◶
-◷
-❍
-⦿
-⊕
-⊗
-•
-·
-∙
-⊙
-⊚
-⊛
-◉
-○
-◌
-◍
-◎
-●
-◘
-◦
-。
-☉
-⦾
-⦿
-⁃
-⁌
-⁍
-◆
-◇
-◈
-★
-☆
-■
-□
-☐
-☑
-☒
-✓
-✔
-❖
-⋄
-❥
-❧
-☙
-☸
-✤
-✱
-✲
-✦
-✧
-↠
-↣
-↦
-↬
-⇛
-⇝
-⇢
-⇨
-➔
-➙
-➛
-➜
-➝
-➞
-➟
-➠
-➡
-➢
-➣
-➤
-➥
-➦
-➧
-➨
-➮
-➱
-➲
-➳
-➵
-➸
-➼
-➽
-➾
-→
-⇾
-⇒
-‣
-▶
-▷
-▸
-▹
-►
-▻
-⣿
-⠿
-⠾
-⠽
-⠼
-⠻
-⠺
-⠹
-⠸
-⠷
-⠶
-⠵
-⠴
-⠳
-⠲
-⠱
-⠰
-⠯
-⠮
-⠭
-⠬
-⠫
-⠪
-⠩
-⠨
-⠧
-⠦
-⠥
-⠤
-⠣
-⠢
-⠡
-⠠
-⠟
-⠞
-⠝
-⠜
-⠛
-⠚
-⠙
-⠘
-⠗
-⠖
-⠕
-⠔
-⠓
-⠒
-⠑
-⠐
-⠏
-⠎
-⠍
-⠌
-⠋
-⠊
-⠉
-⠈
-⠇
-⠆
-⠅
-⠄
-⠃
-⠂
-⠁
-⠀
-∟
-∬
-∭
-∮
-∵
-∷
-≦
-≧
-≋
-╳
-✕
-✖
-✚
-﹢
-﹣
-﹤
-﹥
-%
-+
--
-/
-=
-∧
-∠
-∩
-∪
-°
-÷
-≡
-≥
-∞
-∫
-≤
-≠
-∨
-‰
-‱
-⊥
-π
-±
-√
-∑
-∴
-×
-¬
-Ⅰ
-Ⅱ
-Ⅲ
-Ⅳ
-Ⅴ
-Ⅵ
-Ⅶ
-Ⅷ
-Ⅸ
-Ⅹ
-Ⅺ
-Ⅻ
-ⅰ
-ⅱ
-ⅲ
-ⅳ
-ⅴⅵ
-ⅶ
-ⅷ
-ⅸ
-ⅹ
-ⅺ
-ⅻ
-⓪
-①
-②
-③
-④
-⑤
-⑥
-⑦
-⑧
-⑨
-⑩
-⓵
-⓶
-⓷
-⓸
-⓹
-⓺
-⓻
-⓼
-⓽
-⓾
-⑴
-⑵
-⑶
-⑷
-⑸
-⑹
-⑺
-⑻
-⑼
-⑽
-⓿
-❶
-❷
-❸
-❹
-❺
-❻
-❼
-❽
-❾
-❿
-㈠
-㈡
-㈢
-㈣
-㈤
-㈥
-㈦
-㈧
-㈨
-㈩
-㊀
-㊁
-㊂
-㊃
-㊄
-㊅
-㊆
-㊇
-㊈
-㊉
-0
-1
-2
-3
-4
-5
-6
-7
-8
-9
-
-、
-。
-〈
-〉
-《
-》
-》),
-」
-『
-』
-【
-】
-〔
-〕
-〕〔
-㈧
-壹
-壹.
-壹壹
-壹下
-壹個
-壹些
-壹何
-壹切
-壹則
-壹則通過
-壹天
-壹定
-壹方面
-壹旦
-壹時
-壹來
-壹樣
-壹次
-壹片
-壹番
-壹直
-壹致
-壹般
-壹起
-壹轉眼
-壹邊
-壹面
-七
-萬壹
-三
-三天兩頭
-三番兩次
-三番五次
-上
-上下
-上升
-上去
-上來
-上述
-上面
-下
-下列
-下去
-下來
-下面
-不
-不壹
-不下
-不久
-不了
-不亦樂乎
-不僅
-不僅...而且
-不僅僅
-不僅僅是
-不會
-不但
-不但...而且
-不光
-不免
-不再
-不力
-不單
-不變
-不只
-不可
-不可開交
-不可抗拒
-不同
-不外
-不外乎
-不夠
-不大
-不如
-不妨
-不定
-不對
-不少
-不盡
-不盡然
-不巧
-不已
-不常
-不得
-不得不
-不得了
-不得已
-不必
-不怎麽
-不怕
-不惟
-不成
-不拘
-不擇手段
-不敢
-不料
-不斷
-不日
-不時
-不是
-不曾
-不止
-不止壹次
-不比
-不消
-不滿
-不然
-不然的話
-不特
-不獨
-不由得
-不知不覺
-不管
-不管怎樣
-不經意
-不勝
-不能
-不能不
-不至於
-不若
-不要
-不論
-不起
-不足
-不過
-不叠
-不問
-不限
-與
-與其
-與其說
-與否
-與此同時
-專門
-且
-且不說
-且說
-兩者
-嚴格
-嚴重
-個
-個人
-個別
-中小
-中間
-豐富
-串行
-臨
-臨到
-為
-為主
-為了
-為什麽
-為什麼
-為何
-為止
-為此
-為著
-主張
-主要
-舉凡
-舉行
-乃
-乃至
-乃至於
-麽
-之
-之壹
-之前
-之後
-之後
-之所以
-之類
-烏乎
-乎
-乒
-乘
-乘勢
-乘機
-乘勝
-乘虛
-乘隙
-九
-也
-也好
-也就是說
-也是
-也罷
-了
-了解
-爭取
-二
-二來
-二話不說
-二話沒說
-於
-於是
-於是乎
-雲雲
-雲爾
-互
-互相
-五
-些
-交口
-亦
-產生
-親口
-親手
-親眼
-親自
-親身
-人
-人人
-人們
-人家
-人民
-什麽
-什麽樣
-什麼
-僅
-僅僅
-今
-今後
-今天
-今年
-今後
-介於
-仍
-仍舊
-仍然
-從
-從不
-從嚴
-從中
-從事
-從今以後
-從優
-從古到今
-從古至今
-從頭
-從寬
-從小
-從新
-從無到有
-從早到晚
-從未
-從來
-從此
-從此以後
-從而
-從輕
-從速
-從重
-他
-他人
-他們
-他是
-他的
-代替
-以
-以上
-以下
-以為
-以便
-以免
-以前
-以及
-以後
-以外
-以後
-以故
-以期
-以來
-以至
-以至於
-以致
-們
-任
-任何
-任憑
-任務
-企圖
-夥同
-會
-偉大
-傳
-傳說
-傳聞
-似乎
-似的
-但
-但凡
-但願
-但是
-何
-何樂而不為
-何以
-何況
-何處
-何妨
-何嘗
-何必
-何時
-何止
-何苦
-何須
-余外
-作為
-妳
-妳們
-妳是
-妳的
-使
-使得
-使用
-例如
-依
-依據
-依照
-依靠
-便
-便於
-促進
-保持
-保管
-保險
-俺
-俺們
-倍加
-倍感
-倒不如
-倒不如說
-倒是
-倘
-倘使
-倘或
-倘然
-倘若
-借
-借以
-借此
-假使
-假如
-假若
-偏偏
-做到
-偶爾
-偶而
-儻然
-像
-兒
-允許
-元/噸
-充其極
-充其量
-充分
-先不先
-先後
-先後
-先生
-光
-光是
-全體
-全力
-全年
-全然
-全身心
-全部
-全都
-全面
-八
-八成
-公然
-六
-兮
-共
-共同
-共總
-關於
-其
-其壹
-其中
-其二
-其他
-其余
-其後
-其它
-其實
-其次
-具體
-具體地說
-具體來說
-具體說來
-具有
-兼之
-內
-再
-再其次
-再則
-再有
-再次
-再者
-再者說
-再說
-冒
-沖
-決不
-決定
-決非
-況且
-準備
-湊巧
-凝神
-幾
-幾乎
-幾度
-幾時
-幾番
-幾經
-凡
-凡是
-憑
-憑借
-出
-出於
-出去
-出來
-出現
-分別
-分頭
-分期
-分期分批
-切
-切不可
-切切
-切勿
-切莫
-則
-則甚
-剛
-剛好
-剛巧
-剛才
-初
-別
-別人
-別處
-別是
-別的
-別管
-別說
-到
-到了兒
-到處
-到頭
-到頭來
-到底
-到目前為止
-前後
-前此
-前者
-前進
-前面
-加上
-加之
-加以
-加入
-加強
-動不動
-動輒
-勃然
-匆匆
-十分
-千
-千萬
-千萬千萬
-半
-單
-單單
-單純
-即
-即令
-即使
-即便
-即刻
-即如
-即將
-即或
-即是說
-即若
-卻
-卻不
-歷
-原來
-去
-又
-又及
-及
-及其
-及時
-及至
-雙方
-反之
-反之亦然
-反之則
-反倒
-反倒是
-反應
-反手
-反映
-反而
-反過來
-反過來說
-取得
-取道
-受到
-變成
-古來
-另
-另壹個
-另壹方面
-另外
-另悉
-另方面
-另行
-只
-只當
-只怕
-只是
-只有
-只消
-只要
-只限
-叫
-叫做
-召開
-叮咚
-叮當
-可
-可以
-可好
-可是
-可能
-可見
-各
-各個
-各人
-各位
-各地
-各式
-各種
-各級
-各自
-合理
-同
-同壹
-同時
-同樣
-後
-後來
-後者
-後面
-向
-向使
-向著
-嚇
-嗎
-否則
-吧
-吧噠
-吱
-呀
-呃
-呆呆地
-吶
-嘔
-唄
-嗚
-嗚呼
-呢
-周圍
-呵
-呵呵
-呸
-呼哧
-呼啦
-咋
-和
-咚
-咦
-咧
-咱
-咱們
-咳
-哇
-哈
-哈哈
-哉
-哎
-哎呀
-哎喲
-嘩
-嘩啦
-喲
-哦
-哩
-哪
-哪個
-哪些
-哪兒
-哪天
-哪年
-哪怕
-哪樣
-哪邊
-哪裏
-哼
-哼唷
-唉
-唯有
-啊
-啊呀
-啊哈
-啊喲
-啐
-啥
-啦
-啪達
-啷當
-喀
-餵
-喏
-喔唷
-嘍
-嗡
-嗡嗡
-嗬
-嗯
-噯
-嘎
-嘎嘎
-嘎登
-噓
-嘛
-嘻
-嘿
-嘿嘿
-四
-因
-因為
-因了
-因此
-因著
-因而
-固
-固然
-在
-在下
-在於
-地
-均
-堅決
-堅持
-基於
-基本
-基本上
-處在
-處處
-處理
-復雜
-多
-多麽
-多虧
-多多
-多多少少
-多多益善
-多少
-多年前
-多年來
-多數
-多次
-夠瞧的
-大
-大不了
-大舉
-大事
-大體
-大體上
-大凡
-大力
-大多
-大多數
-大大
-大家
-大張旗鼓
-大批
-大抵
-大概
-大略
-大約
-大致
-大都
-大量
-大面兒上
-失去
-奇
-奈
-奮勇
-她
-她們
-她是
-她的
-好
-好在
-好的
-好象
-如
-如上
-如上所述
-如下
-如今
-如何
-如其
-如前所述
-如同
-如常
-如是
-如期
-如果
-如次
-如此
-如此等等
-如若
-始而
-姑且
-存在
-存心
-孰料
-孰知
-寧
-寧可
-寧願
-寧肯
-它
-它們
-它們的
-它是
-它的
-安全
-完全
-完成
-定
-實現
-實際
-宣布
-容易
-密切
-對
-對於
-對應
-對待
-對方
-對比
-將
-將才
-將要
-將近
-小
-少數
-爾
-爾後
-爾爾
-爾等
-尚且
-尤其
-就
-就地
-就是
-就是了
-就是說
-就此
-就算
-就要
-盡
-盡可能
-盡如人意
-盡心盡力
-盡心竭力
-盡快
-盡早
-盡然
-盡管
-盡管如此
-盡量
-局外
-居然
-屆時
-屬於
-屢
-屢屢
-屢次
-屢次三番
-豈
-豈但
-豈止
-豈非
-川流不息
-左右
-巨大
-鞏固
-差壹點
-差不多
-己
-已
-已矣
-已經
-巴
-巴巴
-帶
-幫助
-常
-常常
-常言說
-常言說得好
-常言道
-平素
-年復壹年
-並
-並不
-並不是
-並且
-並排
-並無
-並沒
-並沒有
-並肩
-並非
-廣大
-廣泛
-應當
-應用
-應該
-庶乎
-庶幾
-開外
-開始
-開展
-引起
-弗
-彈指之間
-強烈
-強調
-歸
-歸根到底
-歸根結底
-歸齊
-當
-當下
-當中
-當兒
-當前
-當即
-當口兒
-當地
-當場
-當頭
-當庭
-當時
-當然
-當真
-當著
-形成
-徹夜
-徹底
-彼
-彼時
-彼此
-往
-往往
-待
-待到
-很
-很多
-很少
-後來
-後面
-得
-得了
-得出
-得到
-得天獨厚
-得起
-心裏
-必
-必定
-必將
-必然
-必要
-必須
-快
-快要
-忽地
-忽然
-怎
-怎麽
-怎麽辦
-怎麽樣
-怎奈
-怎樣
-怎麼
-怕
-急匆匆
-怪
-怪不得
-總之
-總是
-總的來看
-總的來說
-總的說來
-總結
-總而言之
-恍然
-恐怕
-恰似
-恰好
-恰如
-恰巧
-介入
-職務
-規範
-預估
-公告
-增補
-恰恰
-恰恰相反
-恰逢
-您
-您們
-類似
-檢查
-您是
-惟其
-慣常
-意思
-憤然
-願意
-慢說
-成為
-成年
-成本
-成年累月
-成心
-涉及到
-我
-我們
-我是
-我的
-或
-或則
-或多或少
-或是
-或曰
-或者
-或許
-戰鬥
-截然
-截至
-所
-所以
-所在
-所幸
-所有
-所謂
-才
-才能
-撲通
-打
-打從
-打開天窗說亮話
-擴大
-把
-抑或
-抽冷子
-攔腰
-拿
-按
-按時
-按期
-按照
-按理
-按說
-挨個
-挨家挨戶
-挨次
-挨著
-挨門挨戶
-挨門逐戶
-換句話說
-換言之
-據
-據實
-據悉
-據我所知
-據此
-據稱
-據說
-掌握
-接下來
-接著
-接著
-接連不斷
-放量
-故
-故意
-故此
-故而
-敞開兒
-敢
-敢於
-敢情
-數/
-整個
-斷然
-方
-方便
-方才
-方能
-方面
-旁人
-無
-無寧
-無法
-無論
-既
-既...又
-既往
-既是
-既然
-日復壹日
-日漸
-日益
-日臻
-日見
-時候
-昂然
-明顯
-明確
-是
-是不是
-是以
-是否
-是的
-顯然
-顯著
-普通
-普遍
-暗中
-暗地裏
-暗自
-更
-更為
-更加
-更進壹步
-曾
-曾經
-替
-替代
-最
-最後
-最大
-最好
-最後
-最近
-最高
-有
-有些
-有關
-有利
-有力
-有及
-有所
-有效
-有時
-有點
-有的
-有的是
-有著
-有著
-望
-朝
-朝著
-末##末
-本
-本人
-本地
-本著
-本身
-權時
-來
-來不及
-來得及
-來看
-來著
-來自
-來講
-來說
-極
-極為
-極了
-極其
-極力
-極大
-極度
-極端
-構成
-果然
-果真
-某
-某個
-某些
-某某
-根據
-根本
-格外
-梆
-概
-次第
-歡迎
-歟
-正值
-正在
-正如
-正巧
-正常
-正是
-此
-此中
-此後
-此地
-此處
-此外
-此時
-此次
-此間
-殆
-毋寧
-每
-每個
-每天
-每年
-每當
-每時每刻
-每每
-每逢
-比
-比及
-比如
-比如說
-比方
-比照
-比起
-比較
-畢竟
-毫不
-毫無
-毫無例外
-毫無保留地
-汝
-沙沙
-沒
-沒奈何
-沒有
-沿
-沿著
-註意
-活
-深入
-清楚
-滿
-滿足
-漫說
-焉
-然
-然則
-然後
-然後
-然而
-照
-照著
-牢牢
-特別是
-特殊
-特點
-猶且
-猶自
-獨
-獨自
-猛然
-猛然間
-率爾
-率然
-現代
-現在
-理應
-理當
-理該
-瑟瑟
-甚且
-甚麽
-甚或
-甚而
-甚至
-甚至於
-用
-用來
-甫
-甭
-由
-由於
-由是
-由此
-由此可見
-略
-略為
-略加
-略微
-白
-白白
-的
-的確
-的話
-皆可
-目前
-直到
-直接
-相似
-相信
-相反
-相同
-相對
-相對而言
-相應
-相當
-相等
-省得
-看
-看上去
-看出
-看到
-看來
-看樣子
-看看
-看見
-看起來
-真是
-真正
-眨眼
-著
-著呢
-矣
-矣乎
-矣哉
-知道
-砰
-確定
-碰巧
-社會主義
-離
-種
-積極
-移動
-究竟
-窮年累月
-突出
-突然
-竊
-立
-立刻
-立即
-立地
-立時
-立馬
-竟
-竟然
-竟而
-第
-第二
-等
-等到
-等等
-策略地
-簡直
-簡而言之
-簡言之
-管
-類如
-粗
-精光
-緊接著
-累年
-累次
-純
-純粹
-縱
-縱令
-縱使
-縱然
-練習
-組成
-經
-經常
-經過
-結合
-結果
-給
-絕
-絕不
-絕對
-絕非
-絕頂
-繼之
-繼後
-繼續
-繼而
-維持
-綜上所述
-縷縷
-罷了
-老
-老大
-老是
-老老實實
-考慮
-者
-而
-而且
-而況
-而又
-而後
-而外
-而已
-而是
-而言
-而論
-聯系
-聯袂
-背地裏
-背靠背
-能
-能否
-能夠
-騰
-自
-自個兒
-自從
-自各兒
-自後
-自家
-自己
-自打
-自身
-臭
-至
-至於
-至今
-至若
-致
-般的
-良好
-若
-若夫
-若是
-若果
-若非
-範圍
-莫
-莫不
-莫不然
-莫如
-莫若
-莫非
-獲得
-藉以
-雖
-雖則
-雖然
-雖說
-蠻
-行為
-行動
-表明
-表示
-被
-要
-要不
-要不是
-要不然
-要麽
-要是
-要求
-見
-規定
-覺得
-譬喻
-譬如
-認為
-認真
-認識
-讓
-許多
-論
-論說
-設使
-設或
-設若
-誠如
-誠然
-話說
-該
-該當
-說明
-說來
-說說
-請勿
-諸
-諸位
-諸如
-誰
-誰人
-誰料
-誰知
-謹
-豁然
-賊死
-賴以
-趕
-趕快
-趕早不趕晚
-起
-起先
-起初
-起頭
-起來
-起見
-起首
-趁
-趁便
-趁勢
-趁早
-趁機
-趁熱
-趁著
-越是
-距
-跟
-路經
-轉動
-轉變
-轉貼
-轟然
-較
-較為
-較之
-較比
-邊
-達到
-達旦
-迄
-迅速
-過
-過於
-過去
-過來
-運用
-近
-近幾年來
-近年來
-近來
-還
-還是
-還有
-還要
-這
-這壹來
-這個
-這麽
-這麽些
-這麽樣
-這麽點兒
-這些
-這會兒
-這兒
-這就是說
-這時
-這樣
-這次
-這點
-這種
-這般
-這邊
-這裏
-這麼
-進入
-進去
-進來
-進步
-進而
-進行
-連
-連同
-連聲
-連日
-連日來
-連袂
-連連
-遲早
-迫於
-適應
-適當
-適用
-逐步
-逐漸
-通常
-通過
-造成
-逢
-遇到
-遭到
-遵循
-遵照
-避免
-那
-那個
-那麽
-那麽些
-那麽樣
-那些
-那會兒
-那兒
-那時
-那末
-那樣
-那般
-那邊
-那裏
-那麼
-部分
-都
-鄙人
-采取
-裏面
-重大
-重新
-重要
-鑒於
-針對
-長期以來
-長此下去
-長線
-長話短說
-問題
-間或
-防止
-阿
-附近
-陳年
-限制
-陡然
-除
-除了
-除卻
-除去
-除外
-除開
-除此
-除此之外
-除此以外
-除此而外
-除非
-隨
-隨後
-隨時
-隨著
-隨著
-隔夜
-隔日
-難得
-難怪
-難說
-難道
-難道說
-集中
-零
-需要
-非但
-非常
-非徒
-非得
-非特
-非獨
-靠
-頂多
-頃
-頃刻
-頃刻之間
-頃刻間
-順
-順著
-頓時
-頗
-風雨無阻
-飽
-首先
-馬上
-高低
-高興
-默然
-默默地
-齊
-︿
-!
-#
-$
-%
-&
-'
-(
-)
-)÷(1-
-)、
-*
-+
-+ξ
-++
-,
-,也
--
--β
---
--[*]-
-.
-/
-0
-0:2
-1
-1.
-12%
-2
-2.3%
-3
-4
-5
-5:0
-6
-7
-8
-9
-:
-;
-<
-<±
-<Δ
-<λ
-<φ
-<<
-=
-=″
-=☆
-=(
-=-
-=[
-={
->
->λ
-?
-@
-A
-LI
-R.L.
-ZXFITL
-[
-[①①]
-[①②]
-[①③]
-[①④]
-[①⑤]
-[①⑥]
-[①⑦]
-[①⑧]
-[①⑨]
-[①A]
-[①B]
-[①C]
-[①D]
-[①E]
-[①]
-[①a]
-[①c]
-[①d]
-[①e]
-[①f]
-[①g]
-[①h]
-[①i]
-[①o]
-[②
-[②①]
-[②②]
-[②③]
-[②④
-[②⑤]
-[②⑥]
-[②⑦]
-[②⑧]
-[②⑩]
-[②B]
-[②G]
-[②]
-[②a]
-[②b]
-[②c]
-[②d]
-[②e]
-[②f]
-[②g]
-[②h]
-[②i]
-[②j]
-[③①]
-[③⑩]
-[③F]
-[③]
-[③a]
-[③b]
-[③c]
-[③d]
-[③e]
-[③g]
-[③h]
-[④]
-[④a]
-[④b]
-[④c]
-[④d]
-[④e]
-[⑤]
-[⑤]]
-[⑤a]
-[⑤b]
-[⑤d]
-[⑤e]
-[⑤f]
-[⑥]
-[⑦]
-[⑧]
-[⑨]
-[⑩]
-[*]
-[-
-[]
-]
-]∧′=[
-][
-_
-a]
-b]
-c]
-e]
-f]
-ng昉
-{
-{-
-|
-}
-}>
-~
-~±
-~+
-¥
-,
-。
-·
-:
-:
-;
-;
-、
-」
-「
-"
-‵
-’
-′
-‘
-'
-"
-!
-!
-,
-[
-]
-~
-~
-+
-=
--
-`
-)
-(
-)
-(
-〉
-《
-》
-/
-/
-?
-?
-.
-【
-】
-[
-]
-…
-.......
-..
-丨
-|
-—
-≤
-※
-◆
-*
-@
-#
-$
-^
-&
-,
-\
-|
-_
-_
-=
-±
-+
-﹢
-@
-⊕
-⊙
-㊣
-﹫
-﹟
-#
-$
-€
-﹩
-¢
-£
-¥
-%
-﹪
-﹤
-︿
-<
-﹠
-&
-*
-×
-※
-╳
-﹡
-︵
-﹙
-﹚
-︶
--
-¯
-–
-—
-‥
-←
-→
-ˍ
-﹉
-_
- ̄
-≒
-≠
-≡
-≦
-≧
-﹦
-『
-』
-〔
-〕
-︹
-︺
-︻
-︼
-﹁
-﹂
-﹃
-﹄
-﹝
-﹞
-「
-」
-↖
-\
-↘
-﹨
-‘
-’
-′
-﹔
-﹑
-﹑
-·
-‧
-﹒
-.
-÷
-↗
-↙
-∕
-▶
-🔗
-👉
-
-呼籲
-肯定
-統計
-平均
-下降
-萬人
-人口
-高達
-成長
-降低
-逐年
-趨勢
-數量
-全國
-年度
-降到
-落差
-推估
-差距
-件數
-年來
-七成
-一句
-每次
-感受
-幫忙
-要說
-更好
-道理
-永遠
-我講
-想到
-說過
-不想
-記得
-厲害
-心裡
-身為
-鄉下
-做事
-可憐
-媒體
-報導
-新聞
-澄清
-新聞稿
-消息
-發布
-一則
-錯誤
-指出
-記者會
-一篇
-幾天
-評論
-文章
-一隻
-解除
-萬人次
-月底
-年底
-開會
-正式
-第一次
-明天
-第二次
-剩下
-兩次
-還沒
-都還
-答應
-定案
-過了
-信心
-上個
-幾次
-月初
-第三個
-主題
-一家
-第二點
-第一點
-底下
-意義
-道理
-要用
-一部分
-錯誤
-對外
-第三個
-第三點
-差別
-重複
-要給
-所講
-要講
-矛盾
-現階段
-台下
-離開
-對此
-這項
-可否
-不知
-一項
-提及
-安排
-做法
-所說
-在內
-有何
-則是
-只能
-並未
-一事
-所知
-指出
-感到
-何種
-一場
-訴求
-各界
-安排
-與會
-com
-https
-pic
-twlydata
-一張
-通知
-電話
-一天
-照片
-這張
-那天
-當天
-打電話
-一位
-晚上
-聯絡
-幾天
-是嗎
-對吧
-重視
-很快
-都還
-最快
-進一步
-上個
-本院
-擬具
-提議
-增列
-公決
-議事日程
-有當
-敬請
-有鑑於
-增訂
-一屆
-送進來
-一步
-這部
-院會
-順利
-講說
-問你
-我問
-記得
-牽涉到
-講了
-錯誤
-子嗎
-全民
-會後
-題目
-的嗎
-當成
-是嗎
-發揮
-表現
-創造
-用心
-付出
-重視
-貢獻
-帶領
-互動
-感受
-意義
-年來
-第一項
-第二項
-第四條
-第三項
-第三條
-第五條
-院版
-第二條
-第六條
-一項
-第一條
-第七條
-第九條
-第八條
-第十五條
-第一款
-第十四條
-第八
-第十二條
-年度多少錢
-編了
-億多元
-這筆
-多萬元
-年度
-主動
-要花
-一筆
-多錢
-剩下
-一千多
-分配
-用到
-公投
-沒錯
-一塊
-正式
-進度
-ok
-宣導
-推廣
-事後
-事前
-認知
-事先
-預防
-效果
-教育
-行銷
-知識
-大眾
-防範
-做出
-政令
-還滿
-將來
-排除
-效果
-慎重
-還會
-同一個
-講過
-拿來
-這會
-當作
-說服
-回頭
-在外
-性質
-採用
-正面
-不太
-效應
-民間
-最起碼
-行政官員
-樣子
-解決問題
-舉手
-全部都是
-ok
-誤導
-白紙黑字
-當你
-請舉手
-講完
-首長
-在場
-備詢
-先進
-記者
-女士
-夥伴
-上臺
-不在
-簡報
-當年
-往下
-幾位
-一頁
-上台
-煩請
-回座
-我先
-滿多
-實說
-真實
-工具
-情境
-直白
-未必
-到位
-討論一下
-那種
-不太
-幾位
-層次
-還會
-有個
-還滿
-來談
-顧慮
-地講
-對不起
-失望
-坦白講
-個例
-我講
-牽涉到
-我會
-我剛
-內部
-比方說
-差別
-稍微
-我舉
-一段
-剛才講
-好奇
-說真的
-一段時間
-加速
-更好
-三年
-五年
-期限
-半年
-十年
-四年
-上限
-設定
-過了
-只能
-縮短
-每次
-年內
-主動
-管道
-聯繫
-被動
-意願
-接觸
-做過
-提出申請
-扮演
-地去
-會來
-還會
-引發
-很難
-陸陸續續
-研擬
-還不
-再問
-這樣的話
-起碼
-問的
-抱歉
-對啊
-對嗎
-了吧
-樣子
-問了
-無關
-的啊
-一大堆
-講過
-在問
-照理
-是誰
-講法
-一下子
-錯吧
-答案
-安心
-所說
-讓民眾
-給你
-給他
-太大
-功能
-強化
-運作
-品質
-能量
-面向
-建構
-完善
-缺乏
-藉由
-扮演
-價值
-地去
-設立
-凸顯
-很難
-是嗎
-以往
-提問
-對外
-揭露
-甄選
-科目
-這位
-追究
-紀錄
-一而再
-再而三
-一份
-給我
-狀態
-這份
-會後
-回覆
-看過
-ok
-我想問
-書面資料
-再給
-我會
-答案
-問過
-手上
-報告書
-滿意
-想問
-題目
-寫到
-坦白說
-說實話
-承認
-更好
-想像
-這才
-直說
-坦白講
-這裡面
-部裡面
-不見得
-乾脆
-精準
-講了
-搭配
-三位
-尊重
-講清楚
-我講
-講話
-答案
-講了
-問你
-我問
-講得
-隨便
-了嘛
-給你
-一句
-道理
-要講
-了啦
-了啊
-就問
-在講
-對吧
-長期
-疑慮
-定期
-檢視
-短期
-空間
-審慎
-擔憂
-要來
-狀態
-確保
-不論是
-認同
-嚴謹
-層面
-涵蓋
-穩定
-兼顧
-何來
-兩位
-熟悉
-推薦
-組長
-送給
-拜訪
-合適
-下次
-帶頭
-聽過
-願不願意
-很小
-來回
-聽說
-多年
-牽扯
-示範
-轉達
-主政
-細部
-七千
-聽說
-陸續
-最多
-人到
-這麼久
-會給
-分到
-大膽
-我還
-說好
-第十條
-會同
-條款
-第十一條
-法裡面
-寫法
-第五款
-指定
-第十八條
-第六款
-之二
-權利
-限縮
-時程
-完畢
-延後
-上線
-太久
-上半年
-時間表
-今年年底
-拖延
-下個
-這麼久
-預定
-下半年
-遲遲
-延遲
-一再
-去年底
-取代
-高於
-遺憾
-攸關
-凝聚
-非常感謝
-多年
-及第
-照列
-十分之一
-自行
-好啦
-全數
-多一點
-可惜
-留下
-犧牲
-長久以來
-時刻
-這對
-來到
-批評
-留在
-發聲
-一再
-溫暖
-做得好
-這都
-打擊
-加快腳步
-一本
-可惜
-這兩項
-兩項
-點名
-五項
-中有
-在意
-先問
-這不
-兩週
-二分之一
-三分之二
-少於
-第三十三條
-四個
-第二件
-六個月
-第一件
-兩件
-誇張
-對啦
-的嘛
-國是
-好事
-這跟
-私底下
-這就
-原則上
-這要
-解釋一下
-是講
-兩邊
-考慮一下
-連續
-兩天
-實在話
-禮拜一
-禮拜五
-上午
-三天
-標題
-禮拜六
-星期
-禮拜四
-上個月
-十二月
-一般性
-禮拜天
-禮拜三
-這一
-傳出
-忘記
-人會
-我想
-(
-)
-c
diff --git a/.Rproj.user/763C8F27/sources/session-ab45fd2f/C6D09C00-contents b/.Rproj.user/763C8F27/sources/session-ab45fd2f/C6D09C00-contents
deleted file mode 100644
index 894725bf..00000000
--- a/.Rproj.user/763C8F27/sources/session-ab45fd2f/C6D09C00-contents
+++ /dev/null
@@ -1,994 +0,0 @@
-#'@title The Spoken Meeting Records 委員發言
-#'
-#'@author David Liao (davidycliao@@gmail.com)
-#'
-#'@param start_date numeric Must be formatted in Minguo (Taiwan) calendar, e.g. 1090101.
-#'
-#'@param end_date numeric Must be formatted in Minguo (Taiwan) calendar, e.g. 1090102.
-#'
-#'@param meeting_unit NULL The default is NULL, which includes all meeting types
-#' between the starting date and the ending date.
-#'
-#'@param verbose logical, indicates whether `get_meetings` should print out
-#'detailed output when retrieving the data.
-#'
-#'@return list, which contains: \describe{
-#' \item{`title`}{the spoken meeting records }
-#' \item{`query_time`}{the query time}
-#' \item{`retrieved_number`}{the number of the observation}
-#' \item{`meeting_unit`}{the meeting unit}
-#' \item{`start_date_ad`}{the start date in POSIXct}
-#' \item{`end_date_ad`}{the end date in POSIXct}
-#' \item{`start_date`}{the start date in ROC Taiwan calendar}
-#' \item{`url`}{the retrieved json url}
-#' \item{`variable_names`}{the variables of the tibble dataframe}
-#' \item{`manual_info`}{the offical manual, \url{https://www.ly.gov.tw/Pages/List.aspx?nodeid=154}; or use get_variable_info("get_meetings")}
-#' \item{`data`}{a tibble dataframe, whose variables include:
-#' \describe{\item{`smeeting_date`}{會議日期}
-#' \item{`meeting_status`}{會議狀態}
-#' \item{`meeting_name`}{會議名稱}
-#' \item{`meeting_content`}{會議事由}
-#' \item{`speechers`}{委員發言名單}
-#' \item{`meeting_unit`}{主辦單位}
-#' \item{`date_ad`}{西元年}
-#' }
-#' }
-#' }
-#'
-#'@importFrom attempt stop_if_all
-#'@importFrom jsonlite fromJSON
-#'@importFrom withr with_options
-#'
-#'@export
-#'
-#'@examples
-#' ## query meeting records by a period of the dates in Minguo (Taiwan) calendar
-#' ## 輸入「中華民國民年」下載「委員發言」
-#'get_meetings(start_date = "1050120", end_date = "1050210")
-#'
-#' ## query meeting records by a period of the dates in Minguo (Taiwan) calendar format
-#' ## and a meeting
-#' ## 輸入「中華民國民年」與「審查會議或委員會名稱」下載會議審查資訊
-#'get_meetings(start_date = 1060120, end_date = 1070310, meeting_unit = "內政委員會")
-#'
-#'@details `get_meetings` produces a list, which contains `title`, `query_time`,
-#'`retrieved_number`, `meeting_unit`, `start_date_ad`, `end_date_ad`, `start_date`,
-#'`end_date`, `url`, `variable_names`, `manual_info` and `data`.
-#'
-#'@note To retrieve the user manual and more information about variable of the data
-#'frame, please use `get_variable_info("get_meetings")` or visit
-#'the API manual at \url{https://www.ly.gov.tw/Pages/List.aspx?nodeid=154}.
-#'資料似乎不一致,待確認。委員發言(取得最早時間不詳,待檢查。)
-#'
-#'@seealso
-#'`get_variable_info("get_meetings")`
-#'
-#'@seealso
-#' Regarding Minguo calendar, please see \url{https://en.wikipedia.org/wiki/Republic_of_China_calendar}.
-
-get_meetings <- function(start_date = NULL, end_date = NULL, meeting_unit = NULL,
- verbose = TRUE) {
- check_internet()
- api_check(start_date = check_date(start_date), end_date = check_date(end_date))
- set_api_url <- paste("https://www.ly.gov.tw/WebAPI/LegislativeSpeech.aspx?from=",
- start_date, "&to=", end_date, "&meeting_unit=", meeting_unit, "&mode=json", sep = "")
- tryCatch(
- {
- with_options(list(timeout = max(1000, getOption("timeout"))),{json_df <- jsonlite::fromJSON(set_api_url)})
- df <- tibble::as_tibble(json_df)
- attempt::stop_if_all(nrow(df) == 0, isTRUE, msg = "The query is unavailable.")
- df["date_ad"] <- do.call("c", lapply(df$smeeting_date, transformed_date_meeting))
- if (isTRUE(verbose)) {
- cat(" Retrieved URL: \n", set_api_url, "\n")
- cat(" Retrieved via :", meeting_unit, "\n")
- cat(" Retrieved date between:", as.character(check_date(start_date)), "and", as.character(check_date(end_date)), "\n")
- cat(" Retrieved number:", nrow(df), "\n")
- }
- list_data <- list("title" = "the spoken meeting records",
- "query_time" = Sys.time(),
- "retrieved_number" = nrow(df),
- "meeting_unit" = meeting_unit,
- "start_date_ad" = check_date(start_date),
- "end_date_ad" = check_date(end_date),
- "start_date" = start_date,
- "end_date" = end_date,
- "url" = set_api_url,
- "variable_names" = colnames(df),
- "manual_info" = "https://www.ly.gov.tw/Pages/List.aspx?nodeid=154",
- "data" = df)
- return(list_data)
- },
- error = function(error_message) {
- message(error_message)
- }
- )
-}
-
-
-#'@title The Meeting Records of Cross-caucus Session 黨團協商資訊
-#'
-#'@author David Liao (davidycliao@@gmail.com)
-#'
-#'@param start_date character Must be formatted in Minguo (ROC) calendar with three
-#'forward slashes between year, month and day, e.g. "106/10/20".
-#'
-#'@param end_date character Must be formatted in Minguo (ROC) calendar with three
-#'forward slashes between year, month and day, e.g. "109/01/10".
-#'
-#'@param verbose logical, indicates whether `get_caucus_meetings` should print out
-#'detailed output when retrieving the data.
-#'
-#'@return list, which contains: \describe{
-#' \item{`title`}{the meeting records of cross-caucus session}
-#' \item{`query_time`}{the query time}
-#' \item{`retrieved_number`}{the number of observation}
-#' \item{`meeting_unit`}{the meeting unit}
-#' \item{`start_date_ad`}{the start date in POSIXct}
-#' \item{`end_date_ad`}{the end date in POSIXct}
-#' \item{`start_date`}{the start date in ROC Taiwan calendar}
-#' \item{`url`}{the retrieved json url}
-#' \item{`variable_names`}{the variables of the tibble dataframe}
-#' \item{`manual_info`}{the official manual, \url{https://data.ly.gov.tw/getds.action?id=8}; or use get_variable_info("get_caucus_meetings")}
-#' \item{`data`}{a tibble dataframe, whose variables include:
-#' \describe{\item{`comYear`}{卷}
-#' \item{`comVolume`}{期}
-#' \item{`comBookId`}{冊別}
-#' \item{`term`}{屆別}
-#' \item{`sessionPeriod`}{會期}
-#' \item{`meetingTimes`}{臨時會會次}
-#' \item{`meetingDate`}{會議日期(民國年)}
-#' \item{`meetingName`}{會議名稱}
-#' \item{`subject`}{案由}
-#' \item{`pageStart`}{起始頁}
-#' \item{`pageEnd`}{結束頁}
-#' \item{`docUrl`}{檔案下載位置}
-#' \item{`htmlUrl`}{html網址}
-#' \item{`selectTerm`}{屆別期別篩選條件}
-#' }
-#' }
-#' }
-#'
-#'@importFrom attempt stop_if_all
-#'@importFrom jsonlite fromJSON
-#'@importFrom withr with_options
-#'
-#'@export
-#'
-#'@examples
-#' ## query the meeting records of cross-caucus session using a period of
-#' ## the dates in Taiwan ROC calender format with forward slash (/).
-#' ## 輸入「中華民國民年」下載「黨團協商」,輸入時間請依照該格式 "106/10/20",
-#' ## 需有「正斜線」做隔開。
-#'get_caucus_meetings(start_date = "106/10/20", end_date = "107/03/10")
-#'
-#'@details `get_caucus_meetings` produces a list, which contains `title`, `query_time`,
-#'`retrieved_number`, `meeting_unit`, `start_date_ad`, `end_date_ad`, `start_date`,
-#'`end_date`, `url`, `variable_names`, `manual_info` and `data.`
-#'\\ifelse{html}{\\href{https://lifecycle.r-lib.org/articles/stages.html#experimental}{\\figure{lifecycle-experimental.svg}{options: alt='[Experimental]'}}}{\\strong{[Experimental]}}
-#'
-#'@note To retrieve the user manual and more information about variable of the data
-#' frame, please use `get_variable_info("get_caucus_meetings")`
-#' or visit the API manual at \url{https://data.ly.gov.tw/getds.action?id=8}.
-#' 議事類:提供公報之黨團協商資訊 (自第8屆第1會期起)
-#'
-#'@seealso
-#'`get_variable_info("get_caucus_meetings")`
-#'
-#'@seealso
-#' Regarding Minguo calendar, please see \url{https://en.wikipedia.org/wiki/Republic_of_China_calendar}.
-#
-# get_caucus_meetings <- function(start_date = NULL, end_date = NULL,
-# verbose = TRUE) {
-# check_internet()
-# api_check(start_date = transformed_date_meeting(start_date),
-# end_date = transformed_date_meeting(end_date))
-# set_api_url <- paste("https://data.ly.gov.tw/odw/ID8Action.action?comYear=&comVolume=&comBookId=&term=&sessionPeriod=&sessionTimes=&meetingTimes=&meetingDateS=",
-# start_date, "&meetingDateE=", end_date, "&fileType=json", sep = "")
-# tryCatch(
-# {
-# with_options(list(timeout = max(1000, getOption("timeout"))),{json_df <- jsonlite::fromJSON(set_api_url)})
-# df <- tibble::as_tibble(json_df$dataList)
-# attempt::stop_if_all(nrow(df) == 0, isTRUE, msg = "The query is unavailable.")
-# if (isTRUE(verbose)) {
-# cat(" Retrieved URL: \n", set_api_url, "\n")
-# cat(" Retrieved date between:", as.character(transformed_date_meeting(start_date)), "and", as.character(transformed_date_meeting(end_date)), "\n")
-# cat(" Retrieved number:", nrow(df), "\n")
-# }
-# list_data <- list("title" = "the meeting records of cross-caucus session",
-# "query_time" = Sys.time(),
-# "retrieved_number" = nrow(df),
-# "start_date_ad" = transformed_date_meeting(start_date),
-# "end_date_ad" = transformed_date_meeting(end_date),
-# "start_date" = start_date,
-# "end_date" = end_date,
-# "url" = set_api_url,
-# "variable_names" = colnames(df),
-# "manual_info" = "https://data.ly.gov.tw/getds.action?id=8",
-# "data" = df)
-# return(list_data)
-# },
-# error = function(error_message) {
-# message(error_message)
-# }
-# )
-# }
-get_caucus_meetings <- function(start_date = NULL, end_date = NULL,
- verbose = TRUE) {
- # 檢查日期格式
- date_format_check <- function(date) {
- if (!is.null(date) && !grepl("^\\d{3}/\\d{2}/\\d{2}$", date)) {
- stop(paste("Invalid date format:", date, "\n",
- "Please use the format 'YYY/MM/DD' (ROC calendar),\n",
- "For example: '106/10/20'\n",
- "Where YYY is the ROC year (民國年)"))
- }
- }
-
- check_internet()
-
- # 檢查開始和結束日期
- date_format_check(start_date)
- date_format_check(end_date)
-
- if(isTRUE(verbose)) {
- cat("Downloading caucus meetings data...\n")
- pb <- txtProgressBar(min = 0, max = 100, style = 3)
- }
-
- # Update progress bar to 20%
- if(isTRUE(verbose)) setTxtProgressBar(pb, 20)
-
- api_check(start_date = transformed_date_meeting(start_date),
- end_date = transformed_date_meeting(end_date))
-
- # Update progress bar to 40%
- if(isTRUE(verbose)) setTxtProgressBar(pb, 40)
-
- set_api_url <- paste("https://data.ly.gov.tw/odw/ID8Action.action?comYear=&comVolume=&comBookId=&term=&sessionPeriod=&sessionTimes=&meetingTimes=&meetingDateS=",
- start_date, "&meetingDateE=", end_date, "&fileType=json", sep = "")
-
- tryCatch(
- {
- # Update progress bar to 60%
- if(isTRUE(verbose)) setTxtProgressBar(pb, 60)
-
- with_options(list(timeout = max(1000, getOption("timeout"))),{
- json_df <- jsonlite::fromJSON(set_api_url)
- })
-
- # Update progress bar to 80%
- if(isTRUE(verbose)) setTxtProgressBar(pb, 80)
-
- df <- tibble::as_tibble(json_df$dataList)
- attempt::stop_if_all(nrow(df) == 0, isTRUE, msg = "The query is unavailable.")
-
- # Update progress bar to 100% and close it
- if(isTRUE(verbose)) {
- setTxtProgressBar(pb, 100)
- close(pb)
- cat("\n\n") # Add newlines after progress bar
- cat("====== Retrieved Information ======\n")
- cat("-----------------------------------\n")
- cat(" URL: \n", set_api_url, "\n")
- cat(" Date Range: ", as.character(transformed_date_meeting(start_date)),
- " to ", as.character(transformed_date_meeting(end_date)), "\n")
- cat(" Total Meetings: ", nrow(df), "\n")
- cat("===================================\n")
- }
-
- list_data <- list("title" = "the meeting records of cross-caucus session",
- "query_time" = Sys.time(),
- "retrieved_number" = nrow(df),
- "start_date_ad" = transformed_date_meeting(start_date),
- "end_date_ad" = transformed_date_meeting(end_date),
- "start_date" = start_date,
- "end_date" = end_date,
- "url" = set_api_url,
- "variable_names" = colnames(df),
- "manual_info" = "https://data.ly.gov.tw/getds.action?id=8",
- "data" = df)
- return(list_data)
- },
- error = function(error_message) {
- if(isTRUE(verbose)) {
- close(pb)
- cat("\n")
- }
- message(error_message)
- }
- )
-}
-
-#' @title The Video Information of Meetings and Committees 院會及委員會之委員發言片段相關影片資訊
-#'
-#' @param term numeric or NULL. Legislative term number (e.g., 10). Data is available from the 9th term onwards.
-#' @param session_period numeric or NULL. Session period (1-8).
-#' @param start_date character Must be formatted in Minguo (ROC) calendar with three
-#' forward slashes between year, month and day, e.g. "110/10/01".
-#' @param end_date character Must be formatted in Minguo (ROC) calendar with three
-#' forward slashes between year, month and day, e.g. "110/10/30".
-#' @param verbose logical, indicates whether get_speech_video should print out
-#' detailed output when retrieving the data. Default is TRUE.
-#'
-#' @return list, which contains:
-#' \describe{
-#' \item{`title`}{speech video records}
-#' \item{`query_time`}{query timestamp}
-#' \item{`retrieved_number`}{number of videos retrieved}
-#' \item{`term`}{queried legislative term}
-#' \item{`session_period`}{queried session period}
-#' \item{`start_date_ad`}{start date in POSIXct}
-#' \item{`end_date_ad`}{end date in POSIXct}
-#' \item{`start_date`}{start date in ROC calendar}
-#' \item{`end_date`}{end date in ROC calendar}
-#' \item{`url`}{retrieved API URL}
-#' \item{`variable_names`}{variables in the tibble dataframe}
-#' \item{`manual_info`}{official manual URL}
-#' \item{`data`}{a tibble dataframe containing:
-#' \describe{
-#' \item{`term`}{屆別}
-#' \item{`sessionPeriod`}{會期}
-#' \item{`meetingDate`}{會議日期(西元年)}
-#' \item{`meetingTime`}{會議時間}
-#' \item{`meetingTypeName`}{主辦單位}
-#' \item{`meetingName`}{會議名稱}
-#' \item{`meetingContent`}{會議事由}
-#' \item{`legislatorName`}{委員姓名}
-#' \item{`areaName`}{選區名稱}
-#' \item{`speechStartTime`}{委員發言時間起}
-#' \item{`speechEndTime`}{委員發言時間迄}
-#' \item{`speechRecordUrl`}{發言紀錄網址}
-#' \item{`videoLength`}{影片長度}
-#' \item{`videoUrl`}{影片網址}
-#' \item{`selectTerm`}{屆別期別篩選條件}
-#' }
-#' }
-#' }
-#'
-#' @importFrom attempt stop_if_all
-#' @importFrom jsonlite fromJSON
-#' @importFrom withr with_options
-#'
-#' @export
-#'
-#' @examples
-#' ## Query video information by term, session period and date range
-#' get_speech_video(
-#' term = 10,
-#' session_period = 4,
-#' start_date = "110/10/01",
-#' end_date = "110/10/30"
-#' )
-#'
-#' ## Query without specifying term or session
-#' get_speech_video(
-#' start_date = "110/10/01",
-#' end_date = "110/10/30"
-#' )
-#'
-#' @details The `get_speech_video` function retrieves video information of
-#' legislative meetings and committee sessions. Data is available from the
-#' 9th legislative term onwards (2016/民國105年). The date parameters must
-#' use the ROC calendar format with forward slashes.
-#'
-#' @note For more details about the data variables and API information,
-#' use `get_variable_info("get_speech_video")` or visit the API manual at
-#' \url{https://data.ly.gov.tw/getds.action?id=148}.
-#' 會議類:提供立法院院會及委員會之委員發言片段相關影片資訊 (自第9屆第1會期起)。
-#'
-#' @seealso
-#' `get_variable_info("get_speech_video")`
-
-# https://data.ly.gov.tw/odw/ID148Action.action?term=10&sessionPeriod=4&meetingDateS=110/10/01&meetingDateE=110/10/30&meetingTime=&legislatorName=&fileType=csv
-get_speech_video <- function(term = NULL,
- session_period = NULL,
- start_date = NULL,
- end_date = NULL,
- verbose = TRUE,
- format = "json") {
- # Check internet connectivity
- check_internet()
-
- # Format validation
- format <- match.arg(format, c("json", "csv"))
-
- if(isTRUE(verbose)) {
- cat("\nInput Format Information:\n")
- cat("------------------------\n")
- cat("Term: Must be numeric (e.g., 8, 9, 10)\n")
- cat("Session Period: Must be numeric (1-8)\n")
- cat("Date Format: YYY/MM/DD (ROC calendar)\n")
- cat("Example: 110/10/01\n")
- cat("------------------------\n\n")
- cat("Downloading speech video data...\n")
- pb <- txtProgressBar(min = 0, max = 100, style = 3)
- }
-
- # Date validation
- if(is.null(start_date) || is.null(end_date)) {
- stop("Both start_date and end_date must be provided")
- }
-
- # Input data validation
- if(!is.null(term)) {
- term_str <- sprintf("%02d", as.numeric(term))
- } else {
- term_str <- ""
- }
-
- if(!is.null(session_period)) {
- session_str <- sprintf("%02d", as.numeric(session_period))
- } else {
- session_str <- ""
- }
-
- # Update progress bar to 20%
- if(isTRUE(verbose)) setTxtProgressBar(pb, 20)
-
- # Construct API URL
- set_api_url <- paste0("https://data.ly.gov.tw/odw/ID148Action.action?",
- "term=", term_str,
- "&sessionPeriod=", session_str,
- "&meetingDateS=", start_date,
- "&meetingDateE=", end_date,
- "&meetingTime=&legislatorName=&fileType=", format)
-
- # Update progress bar to 40%
- if(isTRUE(verbose)) setTxtProgressBar(pb, 40)
-
- tryCatch(
- {
- # Update progress bar to 60%
- if(isTRUE(verbose)) setTxtProgressBar(pb, 60)
-
- if(format == "json") {
- response <- try({
- json_df <- jsonlite::fromJSON(set_api_url)
- if(!is.null(json_df$dataList)) {
- df <- tibble::as_tibble(json_df$dataList)
- } else {
- df <- tibble::tibble()
- }
- }, silent = TRUE)
- } else {
- response <- try({
- df <- readr::read_csv(set_api_url, show_col_types = FALSE)
- }, silent = TRUE)
- }
-
- # Update progress bar to 80%
- if(isTRUE(verbose)) setTxtProgressBar(pb, 80)
-
- # Data validation
- if(nrow(df) == 0) {
- if(isTRUE(verbose)) {
- setTxtProgressBar(pb, 100)
- close(pb)
- cat("\n\n")
- cat("====== Query Result ======\n")
- cat("-------------------------\n")
- cat("No records found. Please check:\n")
- cat("1. Date format (YYY/MM/DD)\n")
- cat("2. Term and session period\n")
- cat("3. Data availability\n")
- cat("-------------------------\n")
- }
- return(NULL)
- }
-
- # Update progress bar to 100%
- if(isTRUE(verbose)) {
- setTxtProgressBar(pb, 100)
- close(pb)
- cat("\n\n")
- cat("====== Retrieved Information ======\n")
- cat("-----------------------------------\n")
- cat(" Retrieved URL: \n", set_api_url, "\n")
- cat(" Term: ", term_str, "\n")
- if(!is.null(session_period)) {
- cat(" Session Period: ", session_period, "\n")
- }
- cat(" Date Range: ", start_date, " to ", end_date, "\n")
- cat(" Total Videos: ", nrow(df), "\n")
- cat(" Format: ", toupper(format), "\n")
- cat("===================================\n")
- }
-
- # Return data
- list_data <- list(
- "title" = "speech video records",
- "query_time" = Sys.time(),
- "retrieved_number" = nrow(df),
- "term" = term_str,
- "session_period" = session_str,
- "start_date" = start_date,
- "end_date" = end_date,
- "format" = format,
- "url" = set_api_url,
- "variable_names" = colnames(df),
- "manual_info" = "https://data.ly.gov.tw/getds.action?id=148",
- "data" = df
- )
- return(list_data)
- },
- error = function(error_message) {
- if(isTRUE(verbose)) {
- close(pb)
- cat("\nError occurred:\n")
- cat(as.character(error_message), "\n")
- }
- return(NULL)
- }
- )
-}
-
-
-#' The Records of National Public Debates 國是論壇
-#'
-#' @param term numeric or NULL. The default is set to 10. Legislative term number
-#' (e.g., 10). Data is officially available from the 8th term onwards, but
-#' testing shows data starts from the 10th term.
-#'
-#' @param session_period numeric or NULL. Session period number (1-8). Default is NULL.
-#' Use `review_session_info()` to see available session periods in ROC calendar.
-#'
-#' @param verbose logical. Whether to display download progress and detailed information.
-#' Default is TRUE.
-#'
-#' @return A list containing:
-#' \describe{
-#' \item{`title`}{public debates records}
-#' \item{`query_time`}{query timestamp}
-#' \item{`retrieved_number`}{number of records retrieved}
-#' \item{`retrieved_term`}{queried legislative term}
-#' \item{`url`}{retrieved API URL}
-#' \item{`variable_names`}{variables in the tibble dataframe}
-#' \item{`manual_info`}{official manual URL or use get_variable_info("get_public_debates")}
-#' \item{`data`}{a tibble dataframe containing:
-#' \describe{
-#' \item{`term`}{屆別}
-#' \item{`sessionPeriod`}{會期}
-#' \item{`sessionTimes`}{會次}
-#' \item{`meetingTimes`}{臨時會會次}
-#' \item{`dateTimeDesc`}{日期時間說明}
-#' \item{`meetingRoom`}{會議地點}
-#' \item{`chairman`}{主持人}
-#' \item{`legislatorName`}{委員姓名}
-#' \item{`speakType`}{發言類型(paper:書面發言,speak:發言)}
-#' \item{`content`}{內容}
-#' \item{`selectTerm`}{屆別期別篩選條件}
-#' }
-#' }
-#' }
-#'
-#' @importFrom attempt stop_if_all
-#' @importFrom jsonlite fromJSON
-#' @importFrom withr with_options
-#'
-#' @export
-#'
-#' @examples
-#' # Query public debates for term 10, session period 2
-#' debates <- get_public_debates(term = 10, session_period = 2)
-#'
-#' # Query without specifying session period
-#' debates <- get_public_debates(term = 10)
-#'
-#' @details
-#' The function retrieves records from the National Public Debates (國是論壇),
-#' including both spoken and written opinions. While officially available from
-#' the 8th legislative term, testing indicates data is only available from
-#' the 10th term onwards.
-#'
-#' @note
-#' For more details about the data variables and API information,
-#' use `get_variable_info("get_public_debates")` or visit the API manual at
-#' \url{https://data.ly.gov.tw/getds.action?id=7}.
-#' 議事類: 提供公報之國是論壇資訊,並包含書面意見。
-#' 自第8屆第1會期起,但實測資料從第10屆。
-#'
-#' @seealso
-#' * `get_variable_info("get_public_debates")`
-#' * `review_session_info()`
-#' * For ROC calendar information: \url{https://en.wikipedia.org/wiki/Republic_of_China_calendar}
-# get_public_debates <- function(term = NULL, session_period = NULL, verbose = TRUE) {
-# check_internet()
-# if (is.null(term)) {
-# set_api_url <- paste("https://data.ly.gov.tw/odw/ID7Action.action?term=",
-# term, "&sessionPeriod=",
-# "&sessionTimes=&meetingTimes=&legislatorName=&speakType=&fileType=json",
-# sep = "")
-# message(" term is not defined...\n You are now requesting full data from the API. Please make sure your connectivity is stable until its completion.\n")
-# } else {
-# attempt::stop_if_all(term, is.character, msg = "use numeric format only.")
-# if (length(term) == 1) {
-# term <- sprintf("%02d", as.numeric(term))}
-# else if (length(term) > 1) {
-# term <- paste(sprintf("%02d", as.numeric(term)), collapse = "&")
-# message("The API is unable to query multiple terms and the retrieved data might not be complete.")}
-# }
-# set_api_url <- paste("https://data.ly.gov.tw/odw/ID7Action.action?term=",
-# term, "&sessionPeriod=",
-# sprintf("%02d", as.numeric(session_period)),
-# "&sessionTimes=&meetingTimes=&legislatorName=&speakType=&fileType=json",
-# sep = "")
-# tryCatch(
-# {
-# with_options(list(timeout = max(1000, getOption("timeout"))),{json_df <- jsonlite::fromJSON(set_api_url)})
-# df <- tibble::as_tibble(json_df$dataList)
-# attempt::stop_if_all(nrow(df) == 0, isTRUE, msg = "The query is unavailable.")
-# if (isTRUE(verbose)) {
-# cat(" Retrieved URL: \n", set_api_url, "\n")
-# cat(" Retrieved Term: ", term, "\n")
-# cat(" Retrieved Num: ", nrow(df), "\n")
-# }
-# list_data <- list("title" = "the records of the questions answered by the executives",
-# "query_time" = Sys.time(),
-# "retrieved_number" = nrow(df),
-# "retrieved_term" = term,
-# "url" = set_api_url,
-# "variable_names" = colnames(df),
-# "manual_info" = "https://data.ly.gov.tw/getds.action?id=7",
-# "data" = df)
-# return(list_data)
-# },
-# error = function(error_message) {
-# message(error_message)
-# }
-# )
-# }
-
-get_public_debates <- function(term = NULL, session_period = NULL, verbose = TRUE) {
- check_internet()
-
- if(isTRUE(verbose)) {
- cat("\nInput Format Information:\n")
- cat("------------------------\n")
- cat("Term: Must be numeric (e.g., 8, 9, 10)\n")
- cat("Session Period: Must be numeric (1-8)\n")
- cat("------------------------\n\n")
- cat("Downloading public debates data...\n")
- pb <- txtProgressBar(min = 0, max = 100, style = 3)
- }
-
- # Update progress bar to 20%
- if(isTRUE(verbose)) setTxtProgressBar(pb, 20)
-
- if (is.null(term)) {
- set_api_url <- paste("https://data.ly.gov.tw/odw/ID7Action.action?term=",
- term, "&sessionPeriod=",
- "&sessionTimes=&meetingTimes=&legislatorName=&speakType=&fileType=json",
- sep = "")
- message(" term is not defined...\n You are now requesting full data from the API. Please make sure your connectivity is stable until its completion.\n")
- } else {
- attempt::stop_if_all(term, is.character, msg = "use numeric format only.")
- if (length(term) == 1) {
- term <- sprintf("%02d", as.numeric(term))
- } else if (length(term) > 1) {
- if(isTRUE(verbose)) close(pb)
- term <- paste(sprintf("%02d", as.numeric(term)), collapse = "&")
- message("The API is unable to query multiple terms and the retrieved data might not be complete.")
- }
- }
-
- # Update progress bar to 40%
- if(isTRUE(verbose)) setTxtProgressBar(pb, 40)
-
- set_api_url <- paste("https://data.ly.gov.tw/odw/ID7Action.action?term=",
- term, "&sessionPeriod=",
- sprintf("%02d", as.numeric(session_period)),
- "&sessionTimes=&meetingTimes=&legislatorName=&speakType=&fileType=json",
- sep = "")
-
- tryCatch(
- {
- # Update progress bar to 60%
- if(isTRUE(verbose)) setTxtProgressBar(pb, 60)
-
- with_options(list(timeout = max(1000, getOption("timeout"))),{
- json_df <- jsonlite::fromJSON(set_api_url)
- })
-
- # Update progress bar to 80%
- if(isTRUE(verbose)) setTxtProgressBar(pb, 80)
-
- df <- tibble::as_tibble(json_df$dataList)
- attempt::stop_if_all(nrow(df) == 0, isTRUE, msg = "The query is unavailable.")
-
- # Update progress bar to 100%
- if(isTRUE(verbose)) {
- setTxtProgressBar(pb, 100)
- close(pb)
- cat("\n\n") # Add newlines after progress bar
- cat("====== Retrieved Information ======\n")
- cat("-----------------------------------\n")
- cat(" Retrieved URL: \n", set_api_url, "\n")
- cat(" Term: ", term, "\n")
- if(!is.null(session_period)) {
- cat(" Session Period: ", session_period, "\n")
- }
- cat(" Total Records: ", nrow(df), "\n")
- if("legislatorName" %in% colnames(df)) {
- unique_legislators <- length(unique(df$legislatorName))
- cat(" Unique Legislators: ", unique_legislators, "\n")
- }
- cat("===================================\n")
- }
-
- list_data <- list(
- "title" = "public debates records",
- "query_time" = Sys.time(),
- "retrieved_number" = nrow(df),
- "retrieved_term" = term,
- "url" = set_api_url,
- "variable_names" = colnames(df),
- "manual_info" = "https://data.ly.gov.tw/getds.action?id=7",
- "data" = df
- )
- return(list_data)
- },
- error = function(error_message) {
- if(isTRUE(verbose)) {
- close(pb)
- cat("\n")
- }
- message(error_message)
- }
- )
-}
-
-#' The Records of Reviewed Items in the Committees 委員會會議審查之議案項目
-#'
-#'@author David Yen-Chieh Liao
-#'
-#'@param term numeric or null. Data is available only from the 8th term.
-#'The default is set to 10. 參數必須為數值。提供委員會會議審查之議案項目。(自第10屆第1會期起)
-#'
-#'@param session_period integer, numeric or NULL.
-#'`review_session_info()` provides each session period's available options based on the
-#' Minguo (Taiwan) calendar.
-#'
-#'@param verbose logical. This indicates whether `get_executive_response` should
-#'print a detailed output during data retrieval. Default is TRUE.
-#'
-#'@return A list containing:
-#' \item{`title`}{Records of questions answered by executives}
-#' \item{`query_time`}{Time of query}
-#' \item{`retrieved_number`}{Total number of observations}
-#' \item{`retrieved_term`}{Queried term}
-#' \item{`url`}{Retrieved JSON URL}
-#' \item{`variable_names`}{Variables of the tibble dataframe}
-#' \item{`manual_info`}{Official manual, \url{https://data.ly.gov.tw/getds.action?id=46}; or use get_variable_info("get_committee_record")}
-#' \item{`data`}{A tibble dataframe with variables:
-#' \describe{
-#' \item{`term`}{Term number}
-#' \item{`sessionPeriod`}{Session}
-#' \item{`meetingNo`}{Meeting number}
-#' \item{`billNo`}{Bill number}
-#' \item{`selectTerm`}{Term selection filter}
-#' }
-#' }
-#'
-#'@importFrom attempt stop_if_all
-#'@importFrom jsonlite fromJSON
-#'@importFrom withr with_options
-#'
-#'@export
-#'
-#'@examples
-#' ## Query the committee record by term and session period.
-#' ## 輸入「立委屆期」與「會期」下載「委員會審議之議案」
-#'get_committee_record(term = 10, session_period = 1)
-#'
-#'@details `get_committee_record` provides a list which includes `title`,
-#'`query_time`, `retrieved_number`, `retrieved_term`, `url`, `variable_names`,
-#' `manual_info`, and `data`.
-#'
-#'@note
-#' To access the user manual and more information about the data frame's variables,
-#' please refer to `get_variable_info("get_committee_record")` or check the API manual at
-#' \url{https://data.ly.gov.tw/getds.action?id=46}.
-#' This provides agenda items reviewed in committee meetings (from the 10th term, 1st session onwards).
-#'
-#'@seealso
-#'`get_variable_info("get_committee_record")`, `review_session_info()`
-#' The Records of Reviewed Items in the Committees 委員會會議審查之議案項目
-#'
-#'@author David Yen-Chieh Liao
-#'
-#'@param term numeric or null. Data is available only from the 8th term.
-#'The default is set to 10. 參數必須為數值。提供委員會會議審查之議案項目。(自第10屆第1會期起)
-#'
-#'@param session_period integer, numeric or NULL.
-#'`review_session_info()` provides each session period's available options based on the
-#' Minguo (Taiwan) calendar.
-#'
-#'@param verbose logical. This indicates whether `get_executive_response` should
-#'print a detailed output during data retrieval. Default is TRUE.
-#'
-#'@return A list containing:
-#' \item{`title`}{Records of questions answered by executives}
-#' \item{`query_time`}{Time of query}
-#' \item{`retrieved_number`}{Total number of observations}
-#' \item{`retrieved_term`}{Queried term}
-#' \item{`url`}{Retrieved JSON URL}
-#' \item{`variable_names`}{Variables of the tibble dataframe}
-#' \item{`manual_info`}{Official manual, \url{https://data.ly.gov.tw/getds.action?id=46}; or use get_variable_info("get_committee_record")}
-#' \item{`data`}{A tibble dataframe with variables:
-#' \describe{
-#' \item{`term`}{Term number}
-#' \item{`sessionPeriod`}{Session}
-#' \item{`meetingNo`}{Meeting number}
-#' \item{`billNo`}{Bill number}
-#' \item{`selectTerm`}{Term selection filter}
-#' }
-#' }
-#'
-#'@importFrom attempt stop_if_all
-#'@importFrom jsonlite fromJSON
-#'@importFrom withr with_options
-#'
-#'@export
-#'
-#'@examples
-#' ## Query the committee record by term and session period.
-#' ## 輸入「立委屆期」與「會期」下載「委員會審議之議案」
-#'get_committee_record(term = 10, session_period = 1)
-#'
-#'@details `get_committee_record` provides a list which includes `title`,
-#'`query_time`, `retrieved_number`, `retrieved_term`, `url`, `variable_names`,
-#' `manual_info`, and `data`.
-#'
-#'@note
-#' To access the user manual and more information about the data frame's variables,
-#' please refer to `get_variable_info("get_committee_record")` or check the API manual at
-#' \url{https://data.ly.gov.tw/getds.action?id=46}.
-#' This provides agenda items reviewed in committee meetings (from the 10th term, 1st session onwards).
-#'
-#'@seealso
-#'`get_variable_info("get_committee_record")`, `review_session_info()`
-#
-# get_committee_record <- function(term = 10, session_period = NULL, verbose = TRUE) {
-# check_internet()
-# if (is.null(term)) {
-# set_api_url <- paste("https://data.ly.gov.tw/odw/ID46Action.action?term=",
-# term, "&sessionPeriod=",
-# "&sessionTimes=01&meetingTimes=&fileType=json", sep = "")
-# message(" term is not defined...\n You are now requesting full data from the API. Please make sure your connectivity is stable until its completion.\n")
-# } else {
-# attempt::stop_if_all(term, is.character, msg = "use numeric format only.")
-# if (length(term) == 1) {
-# term <- sprintf("%02d", as.numeric(term))}
-# else if (length(term) > 1) {
-# term <- paste(sprintf("%02d", as.numeric(term)), collapse = "&")
-# message("The API is unable to query multiple terms and the retrieved data might not be complete.")}
-# }
-# set_api_url <- paste("https://data.ly.gov.tw/odw/ID46Action.action?term=",
-# term,
-# "&sessionPeriod=", sprintf("%02d", as.numeric(session_period)),
-# "&sessionTimes=01&meetingTimes=&fileType=json", sep = "")
-# tryCatch(
-# {
-# with_options(list(timeout = max(1000, getOption("timeout"))),{json_df <- jsonlite::fromJSON(set_api_url)})
-# df <- tibble::as_tibble(json_df$dataList)
-# attempt::stop_if_all(nrow(df) == 0, isTRUE, msg = "The query is unavailable.")
-# if (isTRUE(verbose)) {
-# cat(" Retrieved URL: \n", set_api_url, "\n")
-# cat(" Retrieved Term: ", term, "\n")
-# cat(" Retrieved Num: ", nrow(df), "\n")
-# }
-# list_data <- list("title" = "the records of reviewed items in the committees",
-# "query_time" = Sys.time(),
-# "retrieved_number" = nrow(df),
-# "retrieved_term" = term,
-# "url" = set_api_url,
-# "variable_names" = colnames(df),
-# "manual_info" = "https://data.ly.gov.tw/getds.action?id=46",
-# "data" = df)
-# return(list_data)
-# },
-# error = function(error_message) {
-# message(error_message)
-# }
-# )
-# }
-get_committee_record <- function(term = 10, session_period = NULL, verbose = TRUE) {
- check_internet()
-
- if(isTRUE(verbose)) {
- cat("\nInput Format Information:\n")
- cat("------------------------\n")
- cat("Term: Must be numeric (e.g., 8, 9, 10)\n")
- cat("Session Period: Must be numeric (1-8)\n")
- cat("------------------------\n\n")
- cat("Downloading committee records data...\n")
- pb <- txtProgressBar(min = 0, max = 100, style = 3)
- }
-
- # Update progress bar to 20%
- if(isTRUE(verbose)) setTxtProgressBar(pb, 20)
-
- if (is.null(term)) {
- set_api_url <- paste("https://data.ly.gov.tw/odw/ID46Action.action?term=",
- term, "&sessionPeriod=",
- "&sessionTimes=01&meetingTimes=&fileType=json", sep = "")
- message(" term is not defined...\n You are now requesting full data from the API. Please make sure your connectivity is stable until its completion.\n")
- } else {
- attempt::stop_if_all(term, is.character, msg = "use numeric format only.")
- if (length(term) == 1) {
- term <- sprintf("%02d", as.numeric(term))
- } else if (length(term) > 1) {
- if(isTRUE(verbose)) close(pb)
- term <- paste(sprintf("%02d", as.numeric(term)), collapse = "&")
- message("The API is unable to query multiple terms and the retrieved data might not be complete.")
- }
- }
-
- # Update progress bar to 40%
- if(isTRUE(verbose)) setTxtProgressBar(pb, 40)
-
- set_api_url <- paste("https://data.ly.gov.tw/odw/ID46Action.action?term=",
- term,
- "&sessionPeriod=", sprintf("%02d", as.numeric(session_period)),
- "&sessionTimes=01&meetingTimes=&fileType=json", sep = "")
-
- tryCatch(
- {
- # Update progress bar to 60%
- if(isTRUE(verbose)) setTxtProgressBar(pb, 60)
-
- with_options(list(timeout = max(1000, getOption("timeout"))),{
- json_df <- jsonlite::fromJSON(set_api_url)
- })
-
- # Update progress bar to 80%
- if(isTRUE(verbose)) setTxtProgressBar(pb, 80)
-
- df <- tibble::as_tibble(json_df$dataList)
- attempt::stop_if_all(nrow(df) == 0, isTRUE, msg = "The query is unavailable.")
-
- # Update progress bar to 100%
- if(isTRUE(verbose)) {
- setTxtProgressBar(pb, 100)
- close(pb)
- cat("\n\n") # Add newlines after progress bar
- cat("====== Retrieved Information ======\n")
- cat("-----------------------------------\n")
- cat(" Retrieved URL: \n", set_api_url, "\n")
- cat(" Term: ", term, "\n")
- if(!is.null(session_period)) {
- cat(" Session Period: ", session_period, "\n")
- }
- cat(" Total Records: ", nrow(df), "\n")
-
- if("committee" %in% colnames(df)) {
- committee_counts <- table(df$committee)
- cat("\nCommittee Distribution:\n")
- for(comm in names(committee_counts)) {
- cat(sprintf(" %s: %d\n", comm, committee_counts[comm]))
- }
- }
- cat("===================================\n")
- }
-
- list_data <- list(
- "title" = "the records of reviewed items in the committees",
- "query_time" = Sys.time(),
- "retrieved_number" = nrow(df),
- "retrieved_term" = term,
- "url" = set_api_url,
- "variable_names" = colnames(df),
- "manual_info" = "https://data.ly.gov.tw/getds.action?id=46",
- "data" = df
- )
- return(list_data)
- },
- error = function(error_message) {
- if(isTRUE(verbose)) {
- close(pb)
- cat("\n")
- }
- message(error_message)
- }
- )
-}
diff --git a/.Rproj.user/763C8F27/sources/session-ab45fd2f/C8A828FE-contents b/.Rproj.user/763C8F27/sources/session-ab45fd2f/C8A828FE-contents
deleted file mode 100644
index b24202e1..00000000
--- a/.Rproj.user/763C8F27/sources/session-ab45fd2f/C8A828FE-contents
+++ /dev/null
@@ -1,117 +0,0 @@
-url: https://davidycliao.github.io/legisTaiwan/
-
-home:
- title: Accessing Real-time and Archives of Taiwan Legislative Data in R
-
- links:
- - text: Discussion
- href: https://github.com/davidycliao/legisTaiwan/discussions
- - text: legisCrawler 爬台灣立法委員問政專輯的爬蟲小幫手️🕸️
- href: https://davidycliao.github.io/legisCrawler/
- - text: "The Centre for Artificial Intelligence in Government (CAIG)"
- href: https://www.birmingham.ac.uk/research/centres-institutes/centre-for-artificial-intelligence-in-government
- - text: "ParlSpeech: Legislative Speeches in the Key Parliamentary Democracies"
- href: https://dataverse.harvard.edu/dataset.xhtml?persistentId=doi:10.7910/DVN/L4OAKN
- - 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
- desc: functions connect to Taiwan Legialtive Yuan API.
-- contents:
- - get_parlquestions
- - get_meetings
- - get_caucus_meetings
- - get_executive_response
- - get_public_debates
- - get_speech_video
- - get_committee_record
- - get_bills
- - get_bills_2
- - get_legislators
- - get_variable_info
- - review_session_info
-
-authors:
- Yen-Chieh Liao:
- href: https://davidycliao.github.io
- Li Tang:
- href: https://sites.google.com/view/litang2020?pli=1
- Taiwan Legislative Yuan 立法院:
- href: "https://data.ly.gov.tw/catelog.action"
- html: ""
-
-
-template:
- package: tidytemplate
- bootstrap: 5
- includes:
- in_header: |
-
- params:
- ganalytics: G-X85ED8P5EW
-
-development:
- mode: auto
-
-navbar:
- type: inverse
- left:
- - icon: fa-home
- href: index.html
- - icon: fa-rocket
- text: Quick Start
- menu:
- - text: "Quick Start Guide"
- href: articles/quickstart.html#get-started-with-using-remotes
- - text: "How to Contribute"
- href: articles/quickstart.html#quickstart.html#how-to-contribute
-
-
- - icon: fa-project-diagram
- text: Manual
- menu:
- - text: "Interpellation and Debates"
- href: articles/manual.html#interpellation-and-debates
- - text: "Bill and Budget"
- href: articles/manual.html#bill-and-budget
- - text: "Miscellaneous"
- href: articles/manual.html#miscellaneous
-
- - icon: fa-file-code-o
- text: Reference
- menu:
- - 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:
- - text: "0.1.6"
- href: news/index.html#legistaiwan-016-development-version
- - text: "0.1.4"
- href: news/index.html#legistaiwan-014-development-version
- - text: "0.1.3"
- href: news/index.html#legistaiwan-013-development-version
- - text: "0.1.1"
- href: news/index.html#legistaiwan-011-development-version
-
- right:
- - icon: fa-github fa-lg
- text: GitHub
- href: https://github.com/davidycliao/legisTaiwan
-
-
-
diff --git a/.Rproj.user/763C8F27/sources/session-ab45fd2f/D0E28724-contents b/.Rproj.user/763C8F27/sources/session-ab45fd2f/D0E28724-contents
deleted file mode 100644
index 44ee3e61..00000000
--- a/.Rproj.user/763C8F27/sources/session-ab45fd2f/D0E28724-contents
+++ /dev/null
@@ -1,369 +0,0 @@
-#' @title The Records of the Bills: 法律提案
-#'
-#' @param start_date numeric. Must be formatted in the ROC Taiwan calendar, e.g., 1090101.
-#' @param end_date numeric. Must be formatted in the ROC Taiwan calendar, e.g., 1090102.
-#' @param proposer The default value is NULL, indicating that bills proposed by all legislators
-#' are included between the start and end dates.
-#' @param verbose logical. Specifies whether `get_bills` should print out
-#' detailed output when retrieving the data. The default value is TRUE.
-#'
-#' @return A list, which contains:
-#' \describe{
-#' \item{`title`}{Records of cross-caucus sessions}
-#' \item{`query_time`}{Query timestamp}
-#' \item{`retrieved_number`}{Number of observations retrieved}
-#' \item{`meeting_unit`}{Meeting unit}
-#' \item{`start_date_ad`}{Start date in POSIXct format}
-#' \item{`end_date_ad`}{End date in POSIXct format}
-#' \item{`start_date`}{Start date in the ROC Taiwan calendar}
-#' \item{`url`}{URL of the retrieved JSON data}
-#' \item{`variable_names`}{Variable names of the tibble dataframe}
-#' \item{`manual_info`}{Official manual. See \url{https://www.ly.gov.tw/Pages/List.aspx?nodeid=153} or use get_variable_info("get_bills")}
-#' \item{`data`}{A tibble dataframe with the following variables:
-#' \describe{\item{`term`}{Session number}
-#' \item{`sessionPeriod`}{Session period}
-#' \item{`sessionTimes`}{Session count}
-#' \item{`meetingTimes`}{Proposal date}
-#' \item{`billName`}{Bill name}
-#' \item{`billProposer`}{Primary proposer}
-#' \item{`billCosignatory`}{Co-signatories of the bill}
-#' \item{`billStatus`}{Status of the bill}
-#' \item{`date_ad`}{Date in the Gregorian calendar}
-#' }
-#' }
-#' }
-#'
-#' @importFrom httr GET
-#' @importFrom httr content
-#' @importFrom jsonlite fromJSON
-#' @importFrom tibble as_tibble
-#' @importFrom withr with_options
-#'
-#' @export
-#'
-#' @examples
-#' \dontrun{
-#' ## Query bill records by a date range in the Taiwan ROC calendar format
-#' get_bills(start_date = 1060120, end_date = 1070310, verbose = TRUE)
-#'
-#' ## Query bill records by a date range and a specific legislator
-#' get_bills(start_date = 1060120, end_date = 1070310, proposer = "孔文吉")
-#'
-#' ## Query bill records by a date range and multiple legislators
-#' get_bills(start_date = 1060120, end_date = 1060510, proposer = "孔文吉&鄭天財")
-#' }
-#'
-#' @details The `get_bills` function returns a list that contains `query_time`,
-#' `retrieved_number`, `meeting_unit`, `start_date_ad`, `end_date_ad`, `start_date`,
-#' `end_date`, `url`, `variable_names`, `manual_info`, and `data`.
-#'
-#' @note To retrieve the user manual and more details about the data frame, use `get_variable_info("get_bills")`.
-#' Further checks are required as the user manual seems to be inconsistent with the actual data.
-#'
-#' @seealso
-#' \url{https://www.ly.gov.tw/Pages/List.aspx?nodeid=153}
-get_bills <- function(start_date = NULL, end_date = NULL, proposer = NULL,
- verbose = TRUE) {
- check_internet()
- api_check(start_date = check_date(start_date), end_date = check_date(end_date))
- validate_dates_format(start_date, end_date)
- set_api_url <- paste("https://www.ly.gov.tw/WebAPI/LegislativeBill.aspx?from=",
- start_date, "&to=", end_date,
- "&proposer=", proposer, "&mode=json", sep = "")
-
- if(isTRUE(verbose)) {
- cat("\nInput Format Information:\n")
- cat("------------------------\n")
- cat("Date format: YYYMMDD (ROC calendar)\n")
- cat("Example: 1090101 for 2020/01/01\n")
- cat("------------------------\n\n")
- cat("Downloading data...\n")
- pb <- txtProgressBar(min = 0, max = 100, style = 3)
- }
-
- tryCatch(
- {
- # 更新進度條到 30%
- if(isTRUE(verbose)) setTxtProgressBar(pb, 30)
-
- with_options(list(timeout = max(1000, getOption("timeout"))),{
- json_df <- jsonlite::fromJSON(set_api_url)
- })
-
- # 更新進度條到 60%
- if(isTRUE(verbose)) setTxtProgressBar(pb, 60)
-
- df <- tibble::as_tibble(json_df)
- attempt::stop_if_all(nrow(df) == 0, isTRUE, msg = "The query is unavailable.")
- df["date_ad"] <- do.call("c", lapply(df$date, transformed_date_bill))
-
- # 更新進度條到 90%
- if(isTRUE(verbose)) setTxtProgressBar(pb, 90)
-
- if(isTRUE(verbose)) {
- setTxtProgressBar(pb, 100)
- close(pb)
- cat("\n\n") # Add newlines after progress bar
- cat("====== Retrieved Information ======\n")
- cat("-----------------------------------\n")
- cat(" Retrieved URL: \n", set_api_url, "\n")
- cat(" Total Unique Proposers:", length(unique(.clean_legislator_names(df$billProposer))), "\n")
- cat(" Retrieved date between:", as.character(check_date(start_date)),
- "and", as.character(check_date(end_date)), "\n")
- cat(" Retrieved Number: ", nrow(df), "\n")
-
- # Add bill statistics
- if(!is.null(df$billProposer)) {
- unique_proposers <- length(unique(.clean_legislator_names(df$billProposer)))
- cat(sprintf(" Total Unique Proposers: %d\n", unique_proposers))
- }
- cat("===================================\n")
- }
-
- list_data <- list("title" = "the records of bill sponsor and co-sponsor",
- "query_time" = Sys.time(),
- "retrieved_number" = nrow(df),
- "proposer" = proposer,
- "start_date_ad" = check_date(start_date),
- "end_date_ad" = check_date(end_date),
- "start_date" = start_date,
- "end_date" = end_date,
- "url" = set_api_url,
- "variable_names" = colnames(df),
- "manual_info" = "https://www.ly.gov.tw/Pages/List.aspx?nodeid=153",
- "data" = df)
- return(list_data)
- },
- error = function(error_message) {
- if(isTRUE(verbose)) {
- close(pb)
- cat("\n")
- }
- message(error_message)
- }
- )
-}
-
-#' @title The Records of Legislation and the Executives Proposals: 委員及政府議案提案資訊
-#'
-#' @author David Liao (davidycliao@@gmail.com)
-#'
-#' @param term A numeric or NULL value. Data is available from the 8th term onwards.
-#' Default is set to 8. 參數必須為數值。資料從第8屆開始,預設值為8。
-#'
-#' @param session_period An integer, numeric, or NULL. Valid options for the session are:
-#' 1, 2, 3, 4, 5, 6, 7, and 8. Default is set to NULL.
-#' 參數必須為數值。
-#' `review_session_info()` provides available session periods based on the Minguo (Taiwan) calendar.
-#'
-#' @param verbose Default value is TRUE. Displays details of the retrieved data, including the number, URL, and computing time.
-#'
-#' @return A list containing:
-#' \item{`title`}{Records of questions answered by the executives}
-#' \item{`query_time`}{Query time}
-#' \item{`retrieved_number`}{Number of observations}
-#' \item{`retrieved_term`}{Retrieved term}
-#' \item{`url`}{Retrieved JSON URL}
-#' \item{`variable_names`}{Variables of the tibble dataframe}
-#' \item{`manual_info`}{Official manual: \url{https://data.ly.gov.tw/getds.action?id=20} or use `get_variable_info("get_bills_2")`}
-#' \item{`data`}{A tibble dataframe with variables such as:
-#' \describe{
-#' \item{`term`}{屆別}
-#' \item{`sessionPeriod`}{會期}
-#' \item{`sessionTimes`}{會次}
-#' \item{`meetingTimes`}{臨時會會次}
-#' \item{`billNo`}{議案編號}
-#' \item{`billName`}{提案名稱}
-#' \item{`billOrg`}{提案單位/委員}
-#' \item{`billProposer`}{主提案人}
-#' \item{`billCosignatory`}{連署提案}
-#' \item{`billStatus`}{議案狀態}
-#' \item{`pdfUrl`}{PDF download link for related documents}
-#' \item{`docUrl`}{DOC download link for related documents}
-#' \item{`selectTerm`}{Filtering criteria based on term}
-#' }
-#' }
-#'
-#' @importFrom attempt stop_if_all
-#' @importFrom jsonlite fromJSON
-#' @importFrom httr GET
-#' @importFrom tibble as_tibble
-#' @importFrom withr with_options
-#'
-#' @export
-#'
-#' @examples
-#' \dontrun{
-#' ## Query the executives' responses by term and session period.
-#' ## 輸入「立委屆期」與「會期」以下載「質詢事項 (行政院答復部分)」
-#' get_bills_2(term = 8, session_period = 1)
-#' }
-#'
-#' @details The `get_bills_2` function produces a list, which includes `query_time`,
-#' `retrieved_number`, `retrieved_term`, `url`, `variable_names`, `manual_info`, and `data`.
-#' For the user manual and more information about the dataframe, use `get_variable_info("get_bills_2")`.
-#'
-#' @note For more details about the dataframe's variables, use `get_variable_info("get_bills_2")`
-#' or visit the API manual at \url{https://data.ly.gov.tw/getds.action?id=20}.
-#' 議事類: 提供委員及政府之議案提案資訊 (從第8屆第1會期開始)。
-#'
-#' @seealso
-#' `get_variable_info("get_bills_2")`,`review_session_info()`
-get_bills_2 <- function(term = 8, session_period = NULL, verbose = TRUE) {
- # Check for internet connectivity
- check_internet()
-
- # Format info at the start
- if(isTRUE(verbose)) {
- cat("\nInput Format Information:\n")
- cat("------------------------\n")
- cat("Term: Must be numeric (e.g., 8, 9, 10, 11)\n")
- cat("Session Period: Must be numeric (1-8)\n")
- cat("------------------------\n\n")
- cat("Downloading legislative bills data...\n")
- pb <- txtProgressBar(min = 0, max = 100, style = 3)
- }
-
- # If the term is not specified
- if (is.null(term)) {
- # Set the base API URL without specifying any term
- set_api_url <- "https://data.ly.gov.tw/odw/ID20Action.action?term=&sessionPeriod=&sessionTimes=&meetingTimes=&billName=&billOrg=&billProposer=&billCosignatory=&fileType=json"
- # Display a notification message
- message("The term is not defined...\nYou are now requesting full data from the API. Please ensure a stable internet connection until completion.\n")
- } else {
- # Update progress bar to 20%
- if(isTRUE(verbose)) setTxtProgressBar(pb, 20)
- # If the term is in character format, stop execution and display an error message
- attempt::stop_if_all(term, is.character, msg = "\nPlease use numeric format only.")
- # If term length is one, format the term to two digits
- if (length(term) == 1) {
- term <- sprintf("%02d", as.numeric(term))
- } else if (length(term) > 1) {
- if(isTRUE(verbose)) close(pb)
- stop("The API doesn't support querying multiple terms. Consider implementing batch processing. Please refer to the tutorial for guidance.")
- }
- # Convert session period to two-digit format, if it's not NULL
- session_str <- ifelse(is.null(session_period), "", sprintf("%02d", as.numeric(session_period)))
- # Construct the complete API URL
- set_api_url <- paste0("https://data.ly.gov.tw/odw/ID20Action.action?term=",
- term, "&sessionPeriod=", session_str,
- "&sessionTimes=&meetingTimes=&billName=&billOrg=&billProposer=&billCosignatory=&fileType=json")
- }
-
- # Update progress bar to 40%
- if(isTRUE(verbose)) setTxtProgressBar(pb, 40)
-
- # Try to fetch the data and process it
- tryCatch(
- {
- with_options(list(timeout = max(1000, getOption("timeout"))),{
- json_df <- jsonlite::fromJSON(set_api_url)
- })
-
- # Update progress bar to 60%
- if(isTRUE(verbose)) setTxtProgressBar(pb, 60)
-
- df <- tibble::as_tibble(json_df$dataList)
-
- # Update progress bar to 80%
- if(isTRUE(verbose)) setTxtProgressBar(pb, 80)
-
- # If the returned data is empty, stop execution and display an error message
- attempt::stop_if_all(nrow(df) == 0, isTRUE, msg = "The query is unavailable.")
-
- # Calculate summary statistics
- total_bills <- nrow(df)
- budget_bills <- if("billName" %in% colnames(df)) sum(grepl("預算", df$billName)) else 0
- budget_percentage <- if(total_bills > 0) (budget_bills / total_bills) * 100 else 0
-
- # Update progress bar to 100%
- if(isTRUE(verbose)) {
- setTxtProgressBar(pb, 100)
- close(pb)
- cat("\n\n") # Add newlines after progress bar
- cat("====== Retrieved Information ======\n")
- cat("-----------------------------------\n")
- cat(" Retrieved URL: \n", set_api_url, "\n")
- if(!is.null(session_period)) {
- cat(" Retrieved Session Period: ", session_period, "\n")
- }
- cat(" Retrieved Term: ", term, "\n")
-
- # Calculate total bills and unique legislators
- total_bills <- nrow(df)
- unique_legislators <- length(unique(.clean_legislator_names(df$billOrg)))
-
- cat(sprintf(" Total Bills: %d\n", total_bills))
- cat(sprintf(" Total Unique Proposers: %d\n", unique_legislators))
- cat("===================================\n")
- # if(isTRUE(verbose)) {
- # setTxtProgressBar(pb, 100)
- # close(pb)
- # cat("\n\n") # Add newlines after progress bar
- # cat("====== Retrieved Information ======\n")
- # cat("-----------------------------------\n")
- # cat(" URL: \n", set_api_url, "\n")
- # cat(" Term: ", term, "\n")
- # if(!is.null(session_period)) {
- # cat(" Session Period: ", session_period, "\n")
- # }
- #
- # # Overall Statistics
- # cat("\nOverall Statistics:\n")
- # cat("-----------------------------------\n")
- # cat(sprintf(" Total Bills: %d\n", total_bills))
- # cat(sprintf(" Budget Bills: %d (%.1f%%)\n", budget_bills, budget_percentage))
- #
- # # Detailed Bill Type Distribution
- # if("billName" %in% colnames(df)) {
- # bill_types <- table(df$billName)
- # cat("\nBill Type Distribution:\n")
- # cat("-----------------------------------\n")
- # for(type in names(bill_types)) {
- # count <- bill_types[type]
- # percentage <- (count / total_bills) * 100
- # cat(sprintf(" %s: %d (%.1f%%)\n", type, count, percentage))
- # }
- # }
- #
- # # Proposer Distribution
- # if("billOrg" %in% colnames(df)) {
- # cat("\nProposer Distribution:\n")
- # cat("-----------------------------------\n")
- # proposer_counts <- table(.clean_legislator_names(df$billOrg))
- # for(proposer in names(proposer_counts)) {
- # count <- proposer_counts[proposer]
- # percentage <- (count / total_bills) * 100
- # if(nchar(trimws(proposer)) > 0) { # Only show non-empty proposers
- # cat(sprintf(" %s: %d (%.1f%%)\n", proposer, count, percentage))
- # }
- # }
- # }
- # cat("===================================\n")
-
- }
-
- # Construct the result list
- list_data <- list(
- "title" = "The records of the questions answered by the executives",
- "query_time" = Sys.time(),
- "retrieved_number" = total_bills,
- "budget_bills" = budget_bills,
- "budget_percentage" = budget_percentage,
- "retrieved_term" = term,
- "url" = set_api_url,
- "variable_names" = colnames(df),
- "manual_info" = "https://data.ly.gov.tw/getds.action?id=2",
- "data" = df
- )
- return(list_data)
- },
- error = function(error_message) {
- if(isTRUE(verbose)) {
- close(pb)
- cat("\n")
- }
- message(error_message)
- }
- )
-}
diff --git a/.Rproj.user/763C8F27/sources/session-ab45fd2f/D47C35DD b/.Rproj.user/763C8F27/sources/session-ab45fd2f/D47C35DD
deleted file mode 100644
index 76a47362..00000000
--- a/.Rproj.user/763C8F27/sources/session-ab45fd2f/D47C35DD
+++ /dev/null
@@ -1,29 +0,0 @@
-{
- "id": "D47C35DD",
- "path": "~/Dropbox/My Packages/legisTaiwan/README.Rmd",
- "project_path": "README.Rmd",
- "type": "r_markdown",
- "hash": "0",
- "contents": "",
- "dirty": false,
- "created": 1698771600546.0,
- "source_on_save": false,
- "relative_order": 1,
- "properties": {
- "source_window_id": "",
- "Source": "Source",
- "cursorPosition": "81,4",
- "scrollLine": "70",
- "rmdVisualMode": "false",
- "rmdVisualCollapsedChunks": "",
- "rmdVisualModeLocation": "2:0"
- },
- "folds": "",
- "lastKnownWriteTime": 1735335571,
- "encoding": "UTF-8",
- "collab_server": "",
- "source_window": "",
- "last_content_update": 1735335571233,
- "read_only": false,
- "read_only_alternatives": []
-}
\ No newline at end of file
diff --git a/.Rproj.user/763C8F27/sources/session-ab45fd2f/D47C35DD-contents b/.Rproj.user/763C8F27/sources/session-ab45fd2f/D47C35DD-contents
deleted file mode 100644
index fb6a627b..00000000
--- a/.Rproj.user/763C8F27/sources/session-ab45fd2f/D47C35DD-contents
+++ /dev/null
@@ -1,103 +0,0 @@
----
-output: github_document
----
-
-
-
-
-## Real-time and Archives of Taiwan Legislative Data in R
-
-
-
-[![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)
-
-
-
-
-```{r, include = FALSE}
-knitr::opts_chunk$set(
- collapse = TRUE,
- comment = "#>",
- fig.path = "man/figures/",
- out.width = "100%"
-)
-```
-
-
-
-
-`legisTaiwan` is designed to streamline access to real-time archives of Taiwan's legislative data, drawing inspiration from the UK's TheyWorkForYou API. By providing straightforward access to the Taiwan Legislative Yuan API in R, this package not only aims to enhance legislative accountability and public transparency but also serves as a powerful tool for academic research. Scholars can easily retrieve and analyze legislative data including voting records, parliamentary questions, and bill proposals, facilitating quantitative research and empirical analysis. As the package interfaces directly with Legislative Yuan API endpoints, a stable internet connection is required. Users are welcome to contact [the author](https://davidycliao.github.io) for any API implementation assistance.
-
-`legisTaiwan` 套件旨在簡化台灣立法院資料的即時存取,其設計理念來自於英國的 TheyWorkForYou API。透過在 R 環境中提供直接連接立法院開放資料 API 的便捷管道,本套件不僅致力於提升立法問責制和公共透明度,更為學術研究者提供了系統化分析立法數據的工具。研究人員可以輕鬆獲取並分析立法委員的表決紀錄、問政質詢、法案提案等資料,有助於量化研究和實證分析。由於套件需要直接與立法院 API 介接,使用時請確保網路連線穩定。如有任何 API 使用上的問題,歡迎與套件[作者](https://davidycliao.github.io)聯繫。
-
-
-
-
-
-
-
-
-
-
-### Get Started with Using [`remotes`](https://github.com/r-lib/remotes):
-
-``` r
-install.packages("remotes")
-remotes::install_github("davidycliao/legisTaiwan", force = TRUE)
-```
-
-```
-library(legisTaiwan)
-#> ## legisTaiwan ##
-#> ## An R package connecting to the Taiwan Legislative API. ##
-```
-
-
-### Summary Descriptive of Current Bills (法案提案統計)
-```{r include=FALSE}
-library(legisTaiwan)
-```
-
-```{r}
-page_info <- get_variable_info("get_bills_2")$page_info
-print(page_info)
-```
-
-### Summary Descriptive of Parliamentary Questions (委員質詢事項)
-
-```{r}
-page_info <- get_variable_info("get_parlquestions")$page_info
-print(page_info)
-```
-
-
-
-
-### Notice:
-
-
-
-`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. Also, consider writing a batch retrieval
-process with appropriate handlers to track the progress of file input,
-ensuring the completeness of the requested data.
-
-
-
-
-
-### Acknowledgments
-
-
-This package supported the author's doctoral dissertation *"Electoral Reform, Distributive Politics, and Parties in the Taiwanese Congress"* at the University of Essex. The PhD project was made possible through the generous funding of the 2022 Taiwan Ministry of Science and Technology (MOST) TOP Grant and a full PhD fellowship from the Ministry of Education (2018-2021), Taiwan. The author extends sincere gratitude to the Legislative Yuan API Center for their technical assistance and commitment to data transparency.
-
diff --git a/.Rproj.user/763C8F27/sources/session-ab45fd2f/DC03663C b/.Rproj.user/763C8F27/sources/session-ab45fd2f/DC03663C
deleted file mode 100644
index 81ab5adb..00000000
--- a/.Rproj.user/763C8F27/sources/session-ab45fd2f/DC03663C
+++ /dev/null
@@ -1,26 +0,0 @@
-{
- "id": "DC03663C",
- "path": "~/Dropbox/My Packages/legisTaiwan/NEWS.md",
- "project_path": "NEWS.md",
- "type": "markdown",
- "hash": "0",
- "contents": "",
- "dirty": false,
- "created": 1735335819059.0,
- "source_on_save": false,
- "relative_order": 5,
- "properties": {
- "source_window_id": "",
- "Source": "Source",
- "cursorPosition": "2,0",
- "scrollLine": "0"
- },
- "folds": "",
- "lastKnownWriteTime": 1735323986,
- "encoding": "UTF-8",
- "collab_server": "",
- "source_window": "",
- "last_content_update": 1735323986,
- "read_only": false,
- "read_only_alternatives": []
-}
\ No newline at end of file
diff --git a/.Rproj.user/763C8F27/sources/session-ab45fd2f/DC03663C-contents b/.Rproj.user/763C8F27/sources/session-ab45fd2f/DC03663C-contents
deleted file mode 100644
index f22aab1b..00000000
--- a/.Rproj.user/763C8F27/sources/session-ab45fd2f/DC03663C-contents
+++ /dev/null
@@ -1,55 +0,0 @@
-
-# `legisTaiwan` 0.1.7
-
-* Enhanced user experience by implementing progress bars for time-intensive operations. Progress bars are now displayed when verbose = TRUE.
-
-* Performed comprehensive spelling and typographical corrections throughout the package documentation and function names.
-
-
-
-------
-
-# `legisTaiwan` 0.1.6
-
-* Corrected spelling errors and standardized terminology across function documentation.
-
-# `legisTaiwan` 0.1.4 (development version)
-
-* re-documentation and inserting handlers.
-
-* formatting the website and documentation: `get_executive_response()`, `get_bills_2()`, `get_debates()` and `get_speech_video()`.
-
-* `get_bills()` and `get_meeting()`'s starting date are not clear.
-
-* `get_public_debates()` manual information is inconsistent with actual data.
-
-* ~~Two API endpoints,`質詢事項(本院委員質詢部分)` ~~and `國是論壇`, are~~ is temporarily down. Therefore, the data retrieved by `get_parlquestions()` ~~and `get_public_debates()`~~ may not be correct. [*UPDATE: Feb 5 2023*]~~
-
-* `get_public_debates()` is on. [*UPDATE: Feb 7 2023*]
-
-
-
-------
-
-# `legisTaiwan` 0.1.3 (development version)
-
-* Fix typo in function name: `get_variabel_infos()` to `get_variable_info()`.
-
-* `get_committee_record() ` is added to access to the records of reviewed items in the committees 提供委員會會議審查之議案項目.
-
-* Add funder and copyright holder in NAMESPACE: `國科會` and `立法院`
-
-* Re-documentation and inserting handlers
-
-
-
-------
-
-# `legisTaiwan` 0.1.1 (development version)
-
-* `get_executive_response()`, `get_bills_2()`, `get_debates()` and `get_speech_video()` are added.
-
-* The package is created with `get_meetings()`, `get_bills()`, `get_legislators()`, `get_parlquestions()`
-
-
-
diff --git a/.Rproj.user/763C8F27/sources/session-ab45fd2f/DEAA0FCB-contents b/.Rproj.user/763C8F27/sources/session-ab45fd2f/DEAA0FCB-contents
deleted file mode 100644
index 7f4d776f..00000000
--- a/.Rproj.user/763C8F27/sources/session-ab45fd2f/DEAA0FCB-contents
+++ /dev/null
@@ -1,47 +0,0 @@
-# `legisTaiwan` 0.1.6
-
-* reformat examples.
-
-* Add testthat to monitor the performance of the Legislative Yan API. If the API malfunctions, the package's percentage of coverage would also decrease.
-
-
-# `legisTaiwan` 0.1.4 (development version)
-
-* re-documentation and inserting handlers.
-
-* formatting the website and documentation: `get_executive_response()`, `get_bills_2()`, `get_debates()` and `get_speech_video()`.
-
-* `get_bills()` and `get_meeting()`'s starting date are not clear.
-
-* `get_public_debates()` manual information is inconsistent with actual data.
-
-* ~~Two API endpoints,`質詢事項(本院委員質詢部分)` ~~and `國是論壇`, are~~ is temporarily down. Therefore, the data retrieved by `get_parlquestions()` ~~and `get_public_debates()`~~ may not be correct. [*UPDATE: Feb 5 2023*]~~
-
-* `get_public_debates()` is on. [*UPDATE: Feb 7 2023*]
-
-
-
-------
-
-# `legisTaiwan` 0.1.3 (development version)
-
-* Fix typo in function name: `get_variabel_infos()` to `get_variable_info()`.
-
-* `get_committee_record() ` is added to access to the records of reviewed items in the committees 提供委員會會議審查之議案項目.
-
-* Add funder and copyright holder in NAMESPACE: `國科會` and `立法院`
-
-* Re-documentation and inserting handlers
-
-
-
-------
-
-# `legisTaiwan` 0.1.1 (development version)
-
-* `get_executive_response()`, `get_bills_2()`, `get_debates()` and `get_speech_video()` are added.
-
-* The package is created with `get_meetings()`, `get_bills()`, `get_legislators()`, `get_parlquestions()`
-
-
-
diff --git a/.Rproj.user/763C8F27/sources/session-ab45fd2f/E2D07B9F-contents b/.Rproj.user/763C8F27/sources/session-ab45fd2f/E2D07B9F-contents
deleted file mode 100644
index af1fa434..00000000
--- a/.Rproj.user/763C8F27/sources/session-ab45fd2f/E2D07B9F-contents
+++ /dev/null
@@ -1,373 +0,0 @@
-#'The Records of the Bills: 法律提案
-#'
-#' @param start_date numeric. Must be formatted in the ROC Taiwan calendar, e.g., 1090101.
-#' @param end_date numeric. Must be formatted in the ROC Taiwan calendar, e.g., 1090102.
-#' @param proposer The default value is NULL, indicating that bills proposed by all legislators
-#' are included between the start and end dates.
-#' @param verbose logical. Specifies whether `get_bills` should print out
-#' detailed output when retrieving the data. The default value is TRUE.
-#'
-#' @return A list, which contains:
-#' \describe{
-#' \item{`title`}{Records of cross-caucus sessions}
-#' \item{`query_time`}{Query timestamp}
-#' \item{`retrieved_number`}{Number of observations retrieved}
-#' \item{`meeting_unit`}{Meeting unit}
-#' \item{`start_date_ad`}{Start date in POSIXct format}
-#' \item{`end_date_ad`}{End date in POSIXct format}
-#' \item{`start_date`}{Start date in the ROC Taiwan calendar}
-#' \item{`url`}{URL of the retrieved JSON data}
-#' \item{`variable_names`}{Variable names of the tibble dataframe}
-#' \item{`manual_info`}{Official manual. See \url{https://www.ly.gov.tw/Pages/List.aspx?nodeid=153} or use get_variable_info("get_bills")}
-#' \item{`data`}{A tibble dataframe with the following variables:
-#' \describe{\item{`term`}{Session number}
-#' \item{`sessionPeriod`}{Session period}
-#' \item{`sessionTimes`}{Session count}
-#' \item{`meetingTimes`}{Proposal date}
-#' \item{`billName`}{Bill name}
-#' \item{`billProposer`}{Primary proposer}
-#' \item{`billCosignatory`}{Co-signatories of the bill}
-#' \item{`billStatus`}{Status of the bill}
-#' \item{`date_ad`}{Date in the Gregorian calendar}
-#' }
-#' }
-#' }
-#'
-#' @import utils
-#' @importFrom httr GET
-#' @importFrom httr content
-#' @importFrom jsonlite fromJSON
-#' @importFrom tibble as_tibble
-#' @importFrom withr with_options
-#'
-#' @export
-#'
-#' @examples
-#' \dontrun{
-#' ## Query bill records by a date range in the Taiwan ROC calendar format
-#' get_bills(start_date = 1060120, end_date = 1070310, verbose = TRUE)
-#'
-#' ## Query bill records by a date range and a specific legislator
-#' get_bills(start_date = 1060120, end_date = 1070310, proposer = "孔文吉")
-#'
-#' ## Query bill records by a date range and multiple legislators
-#' get_bills(start_date = 1060120, end_date = 1060510, proposer = "孔文吉&鄭天財")
-#' }
-#'
-#' @details The `get_bills` function returns a list that contains `query_time`,
-#' `retrieved_number`, `meeting_unit`, `start_date_ad`, `end_date_ad`, `start_date`,
-#' `end_date`, `url`, `variable_names`, `manual_info`, and `data`.
-#'
-#' @note To retrieve the user manual and more details about the data frame, use `get_variable_info("get_bills")`.
-#' Further checks are required as the user manual seems to be inconsistent with the actual data.
-#'
-#' @seealso
-#' \url{https://www.ly.gov.tw/Pages/List.aspx?nodeid=153}
-get_bills <- function(start_date = NULL, end_date = NULL, proposer = NULL,
- verbose = TRUE) {
- check_internet()
- api_check(start_date = check_date(start_date), end_date = check_date(end_date))
- validate_dates_format(start_date, end_date)
- set_api_url <- paste("https://www.ly.gov.tw/WebAPI/LegislativeBill.aspx?from=",
- start_date, "&to=", end_date,
- "&proposer=", proposer, "&mode=json", sep = "")
-
- if(isTRUE(verbose)) {
- cat("\nInput Format Information:\n")
- cat("------------------------\n")
- cat("Date format: YYYMMDD (ROC calendar)\n")
- cat("Example: 1090101 for 2020/01/01\n")
- cat("------------------------\n\n")
- cat("Downloading data...\n")
- pb <- txtProgressBar(min = 0, max = 100, style = 3)
- }
-
- tryCatch(
- {
- # 更新進度條到 30%
- if(isTRUE(verbose)) setTxtProgressBar(pb, 30)
-
- with_options(list(timeout = max(1000, getOption("timeout"))),{
- json_df <- jsonlite::fromJSON(set_api_url)
- })
-
- # 更新進度條到 60%
- if(isTRUE(verbose)) setTxtProgressBar(pb, 60)
-
- df <- tibble::as_tibble(json_df)
- attempt::stop_if_all(nrow(df) == 0, isTRUE, msg = "The query is unavailable.")
- df["date_ad"] <- do.call("c", lapply(df$date, transformed_date_bill))
-
- # 更新進度條到 90%
- if(isTRUE(verbose)) setTxtProgressBar(pb, 90)
-
- if(isTRUE(verbose)) {
- setTxtProgressBar(pb, 100)
- close(pb)
- cat("\n\n") # Add newlines after progress bar
- cat("====== Retrieved Information ======\n")
- cat("-----------------------------------\n")
- cat(" Retrieved URL: \n", set_api_url, "\n")
- cat(" Total Unique Proposers:", length(unique(.clean_names(df$billProposer))), "\n")
- cat(" Retrieved date between:", as.character(check_date(start_date)),
- "and", as.character(check_date(end_date)), "\n")
- cat(" Retrieved Number: ", nrow(df), "\n")
-
- # Add bill statistics
- if(!is.null(df$billProposer)) {
- unique_proposers <- length(unique(.clean_names(df$billProposer)))
- cat(sprintf(" Total Unique Proposers: %d\n", unique_proposers))
- }
- cat("===================================\n")
- }
-
- list_data <- list("title" = "the records of bill sponsor and co-sponsor",
- "query_time" = Sys.time(),
- "retrieved_number" = nrow(df),
- "proposer" = proposer,
- "start_date_ad" = check_date(start_date),
- "end_date_ad" = check_date(end_date),
- "start_date" = start_date,
- "end_date" = end_date,
- "url" = set_api_url,
- "variable_names" = colnames(df),
- "manual_info" = "https://www.ly.gov.tw/Pages/List.aspx?nodeid=153",
- "data" = df)
- return(list_data)
- },
- error = function(error_message) {
- if(isTRUE(verbose)) {
- close(pb)
- cat("\n")
- }
- message(error_message)
- }
- )
-}
-
-
-#' The Records of Legislation and the Executives Proposals: 委員及政府議案提案資訊
-#' @title The Records of Legislation and the Executives Proposals: 委員及政府議案提案資訊
-#'
-#' @author David Liao (davidycliao@@gmail.com)
-#'
-#' @param term A numeric or NULL value. Data is available from the 8th term onwards.
-#' Default is set to 8. 參數必須為數值。資料從第8屆開始,預設值為8。
-#'
-#' @param session_period An integer, numeric, or NULL. Valid options for the session are:
-#' 1, 2, 3, 4, 5, 6, 7, and 8. Default is set to NULL.
-#' 參數必須為數值。
-#' `review_session_info()` provides available session periods based on the Minguo (Taiwan) calendar.
-#'
-#' @param verbose Default value is TRUE. Displays details of the retrieved data, including the number, URL, and computing time.
-#'
-#' @return A list containing:
-#' \item{`title`}{Records of questions answered by the executives}
-#' \item{`query_time`}{Query time}
-#' \item{`retrieved_number`}{Number of observations}
-#' \item{`retrieved_term`}{Retrieved term}
-#' \item{`url`}{Retrieved JSON URL}
-#' \item{`variable_names`}{Variables of the tibble dataframe}
-#' \item{`manual_info`}{Official manual: \url{https://data.ly.gov.tw/getds.action?id=20} or use `get_variable_info("get_bills_2")`}
-#' \item{`data`}{A tibble dataframe with variables such as:
-#' \describe{
-#' \item{`term`}{屆別}
-#' \item{`sessionPeriod`}{會期}
-#' \item{`sessionTimes`}{會次}
-#' \item{`meetingTimes`}{臨時會會次}
-#' \item{`billNo`}{議案編號}
-#' \item{`billName`}{提案名稱}
-#' \item{`billOrg`}{提案單位/委員}
-#' \item{`billProposer`}{主提案人}
-#' \item{`billCosignatory`}{連署提案}
-#' \item{`billStatus`}{議案狀態}
-#' \item{`pdfUrl`}{PDF download link for related documents}
-#' \item{`docUrl`}{DOC download link for related documents}
-#' \item{`selectTerm`}{Filtering criteria based on term}
-#' }
-#' }
-#'
-#' @import utils
-#' @importFrom attempt stop_if_all
-#' @importFrom jsonlite fromJSON
-#' @importFrom httr GET
-#' @importFrom tibble as_tibble
-#' @importFrom withr with_options
-#'
-#' @export
-#'
-#' @examples
-#' \dontrun{
-#' ## Query the executives' responses by term and session period.
-#' ## 輸入「立委屆期」與「會期」以下載「質詢事項 (行政院答復部分)」
-#' get_bills_2(term = 8, session_period = 1)
-#' }
-#'
-#' @details The `get_bills_2` function produces a list, which includes `query_time`,
-#' `retrieved_number`, `retrieved_term`, `url`, `variable_names`, `manual_info`, and `data`.
-#' For the user manual and more information about the dataframe, use `get_variable_info("get_bills_2")`.
-#'
-#' @note For more details about the dataframe's variables, use `get_variable_info("get_bills_2")`
-#' or visit the API manual at \url{https://data.ly.gov.tw/getds.action?id=20}.
-#' 議事類: 提供委員及政府之議案提案資訊 (從第8屆第1會期開始)。
-#'
-#' @seealso
-#' `get_variable_info("get_bills_2")`,`review_session_info()`
-get_bills_2 <- function(term = 8, session_period = NULL, verbose = TRUE) {
- # Check for internet connectivity
- check_internet()
-
- # Format info at the start
- if(isTRUE(verbose)) {
- cat("\nInput Format Information:\n")
- cat("------------------------\n")
- cat("Term: Must be numeric (e.g., 8, 9, 10, 11)\n")
- cat("Session Period: Must be numeric (1-8)\n")
- cat("------------------------\n\n")
- cat("Downloading legislative bills data...\n")
- pb <- txtProgressBar(min = 0, max = 100, style = 3)
- }
-
- # If the term is not specified
- if (is.null(term)) {
- # Set the base API URL without specifying any term
- set_api_url <- "https://data.ly.gov.tw/odw/ID20Action.action?term=&sessionPeriod=&sessionTimes=&meetingTimes=&billName=&billOrg=&billProposer=&billCosignatory=&fileType=json"
- # Display a notification message
- message("The term is not defined...\nYou are now requesting full data from the API. Please ensure a stable internet connection until completion.\n")
- } else {
- # Update progress bar to 20%
- if(isTRUE(verbose)) setTxtProgressBar(pb, 20)
- # If the term is in character format, stop execution and display an error message
- attempt::stop_if_all(term, is.character, msg = "\nPlease use numeric format only.")
- # If term length is one, format the term to two digits
- if (length(term) == 1) {
- term <- sprintf("%02d", as.numeric(term))
- } else if (length(term) > 1) {
- if(isTRUE(verbose)) close(pb)
- stop("The API doesn't support querying multiple terms. Consider implementing batch processing. Please refer to the tutorial for guidance.")
- }
- # Convert session period to two-digit format, if it's not NULL
- session_str <- ifelse(is.null(session_period), "", sprintf("%02d", as.numeric(session_period)))
- # Construct the complete API URL
- set_api_url <- paste0("https://data.ly.gov.tw/odw/ID20Action.action?term=",
- term, "&sessionPeriod=", session_str,
- "&sessionTimes=&meetingTimes=&billName=&billOrg=&billProposer=&billCosignatory=&fileType=json")
- }
-
- # Update progress bar to 40%
- if(isTRUE(verbose)) setTxtProgressBar(pb, 40)
-
- # Try to fetch the data and process it
- tryCatch(
- {
- with_options(list(timeout = max(1000, getOption("timeout"))),{
- json_df <- jsonlite::fromJSON(set_api_url)
- })
-
- # Update progress bar to 60%
- if(isTRUE(verbose)) setTxtProgressBar(pb, 60)
-
- df <- tibble::as_tibble(json_df$dataList)
-
- # Update progress bar to 80%
- if(isTRUE(verbose)) setTxtProgressBar(pb, 80)
-
- # If the returned data is empty, stop execution and display an error message
- attempt::stop_if_all(nrow(df) == 0, isTRUE, msg = "The query is unavailable.")
-
- # Calculate summary statistics
- total_bills <- nrow(df)
- budget_bills <- if("billName" %in% colnames(df)) sum(grepl("預算", df$billName)) else 0
- budget_percentage <- if(total_bills > 0) (budget_bills / total_bills) * 100 else 0
-
- # Update progress bar to 100%
- if(isTRUE(verbose)) {
- setTxtProgressBar(pb, 100)
- close(pb)
- cat("\n\n") # Add newlines after progress bar
- cat("====== Retrieved Information ======\n")
- cat("-----------------------------------\n")
- cat(" Retrieved URL: \n", set_api_url, "\n")
- if(!is.null(session_period)) {
- cat(" Retrieved Session Period: ", session_period, "\n")
- }
- cat(" Retrieved Term: ", term, "\n")
-
- # Calculate total bills and unique legislators
- total_bills <- nrow(df)
- unique_legislators <- length(unique(.clean_names(df$billOrg)))
-
- cat(sprintf(" Total Bills: %d\n", total_bills))
- cat(sprintf(" Total Unique Proposers: %d\n", unique_legislators))
- cat("===================================\n")
- # if(isTRUE(verbose)) {
- # setTxtProgressBar(pb, 100)
- # close(pb)
- # cat("\n\n") # Add newlines after progress bar
- # cat("====== Retrieved Information ======\n")
- # cat("-----------------------------------\n")
- # cat(" URL: \n", set_api_url, "\n")
- # cat(" Term: ", term, "\n")
- # if(!is.null(session_period)) {
- # cat(" Session Period: ", session_period, "\n")
- # }
- #
- # # Overall Statistics
- # cat("\nOverall Statistics:\n")
- # cat("-----------------------------------\n")
- # cat(sprintf(" Total Bills: %d\n", total_bills))
- # cat(sprintf(" Budget Bills: %d (%.1f%%)\n", budget_bills, budget_percentage))
- #
- # # Detailed Bill Type Distribution
- # if("billName" %in% colnames(df)) {
- # bill_types <- table(df$billName)
- # cat("\nBill Type Distribution:\n")
- # cat("-----------------------------------\n")
- # for(type in names(bill_types)) {
- # count <- bill_types[type]
- # percentage <- (count / total_bills) * 100
- # cat(sprintf(" %s: %d (%.1f%%)\n", type, count, percentage))
- # }
- # }
- #
- # # Proposer Distribution
- # if("billOrg" %in% colnames(df)) {
- # cat("\nProposer Distribution:\n")
- # cat("-----------------------------------\n")
- # proposer_counts <- table(.clean_legislator_names(df$billOrg))
- # for(proposer in names(proposer_counts)) {
- # count <- proposer_counts[proposer]
- # percentage <- (count / total_bills) * 100
- # if(nchar(trimws(proposer)) > 0) { # Only show non-empty proposers
- # cat(sprintf(" %s: %d (%.1f%%)\n", proposer, count, percentage))
- # }
- # }
- # }
- # cat("===================================\n")
-
- }
-
- # Construct the result list
- list_data <- list(
- "title" = "The records of the questions answered by the executives",
- "query_time" = Sys.time(),
- "retrieved_number" = total_bills,
- "budget_bills" = budget_bills,
- "budget_percentage" = budget_percentage,
- "retrieved_term" = term,
- "url" = set_api_url,
- "variable_names" = colnames(df),
- "manual_info" = "https://data.ly.gov.tw/getds.action?id=2",
- "data" = df
- )
- return(list_data)
- },
- error = function(error_message) {
- if(isTRUE(verbose)) {
- close(pb)
- cat("\n")
- }
- message(error_message)
- }
- )
-}
diff --git a/.Rproj.user/763C8F27/sources/session-ab45fd2f/E524D700-contents b/.Rproj.user/763C8F27/sources/session-ab45fd2f/E524D700-contents
deleted file mode 100644
index a11bdd45..00000000
--- a/.Rproj.user/763C8F27/sources/session-ab45fd2f/E524D700-contents
+++ /dev/null
@@ -1,43 +0,0 @@
-Package: legisTaiwan
-Type: Package
-Title: An Interface to Access Taiwan Legislative API in R
-Version: 0.1.7
-Authors@R: c(person("Yen-Chieh", "Liao", email = "davidycliao@gmail.com", role = c("aut", "cre")),
- person("Li", "Tang", email = "li.tang@reading.ac.uk", role = c("ctb", "aut")),
- person("Taiwan Legislative Yuan 立法院", role = c("cph", "fnd")),
- person("Taiwan National Science and Technology Council", role = "ctb"),
- person("Taiwan Science & Technology Policy Research and Information Center NARLabs", role = "ctb"))
-Description: The pacakge is designed to make it quickly and easy to access Taiwan
- Legislative Yuan API for downloading real-time data legislative and
- historical archives.
-Maintainer: Yen-Chieh Liao
-Depends: R (>= 3.4.0)
-License: GPL-3 + file LICENSE
-Encoding: UTF-8
-LazyData: true
-Imports:
- jsonlite,
- attempt,
- stringr,
- curl,
- tibble,
- rvest,
- withr,
- httr,
- utils,
- readr
-Suggests:
- knitr,
- rmarkdown,
- ggplot2,
- remotes,
- tidyverse,
- testthat (>= 3.0.0)
-RoxygenNote: 7.3.2
-BugReports: https://github.com/davidycliao/legisTaiwan/issues
-URL: https://davidycliao.github.io/legisTaiwan/
-VignetteBuilder: knitr
-Roxygen: list(markdown = TRUE)
-Config/testthat/edition: 3
-SystemRequirements: pandoc (>= 1.14) - http://pandoc.org
-Config/default/buildignore-noascii: TRUE
diff --git a/.Rproj.user/763C8F27/sources/session-ab45fd2f/EB5DECD1-contents b/.Rproj.user/763C8F27/sources/session-ab45fd2f/EB5DECD1-contents
deleted file mode 100644
index 3cafe183..00000000
--- a/.Rproj.user/763C8F27/sources/session-ab45fd2f/EB5DECD1-contents
+++ /dev/null
@@ -1,251 +0,0 @@
-#' Clean legislator names
-#'
-#' @keywords internal
-#' @noRd
-.clean_names <- function(x) {
- names <- x %>%
- gsub("本院委員", "", .) %>%
- gsub("委員", "", .) %>%
- gsub("等\\s*\\d+\\s*人", "", .) %>%
- gsub("等\\d+人", "", .) %>%
- gsub("等", "", .) %>%
- gsub("\\s+", "", .) %>%
- gsub("本院", "", .) %>%
- trimws()
-
- return(names)
-}
-
-
-#' Validate Date Formats
-#'
-#' This function checks if the provided start and end dates are in the correct numeric format.
-#'
-#' @param start_date A string representing the start date. Expected format is numeric, e.g., "1090101".
-#' @param end_date A string representing the end date. Expected format is numeric, e.g., "1090101".
-#' @return NULL. If the dates are not in the expected format, an error is thrown.
-#' @examples
-#' # This should throw an error:
-#' \dontrun{
-#' validate_dates_format("10901", "1100101")
-#' }
-#' @keywords internal
-validate_dates_format <- function(start_date, end_date) {
- valid_date_format <- function(date) {
- return(grepl("^\\d{7}$", date))
- }
-
- if (!valid_date_format(start_date) || !valid_date_format(end_date)) {
- stop("Dates should be in numeric format. E.g., 1090101.")
- }
-}
-
-
-#' Check for the Website Availability I
-#'
-#' This function checks the availability of a specified website by trying to read
-#' the first line of the site's content.
-#'
-#' @param site A website URL to check. Default is "https://data.ly.gov.tw/index.action".
-#'
-#' @seealso
-#' `check_internet()`
-#'
-#' @keywords internal
-website_availability <- function(site = "https://data.ly.gov.tw/index.action") {
- tryCatch({
- readLines(site, n = 1)
- TRUE
- },
- warning = function(w) invokeRestart("muffleWarning"),
- error = function(e) FALSE)
-}
-
-#' Check for the Website Availability II
-#'
-#' This function checks the availability of a specified website by trying to read
-#' the first line of the site's content.
-#'
-#' @param site A website URL to check. Default is "https://npl.ly.gov.tw/do/www/appDate?status=0&expire=02&startYear=0".
-#'
-#' @keywords internal
-#' @seealso `check_internet()` and `website_availability()`.
-website_availability2 <- function(site = "https://npl.ly.gov.tw/do/www/appDate?status=0&expire=02&startYear=0") {
- tryCatch({
- readLines(site, n = 1)
- TRUE
- },
- warning = function(w) invokeRestart("muffleWarning"),
- error = function(e) FALSE)
-}
-
-
-
-#' A Check for Internet Connectivity.
-#'
-#'@param x The default value is `curl::has_internet()`, which activate the
-#'internet connectivity check.
-#'
-#'@importFrom attempt stop_if_not
-#'
-#'@importFrom curl has_internet
-#'
-#'@keywords internal
-check_internet <- function(x = curl::has_internet()) {
- attempt::stop_if_not(.x = x,
- msg = "Please check the internet connection")
-}
-
-#' A General Check for Taiwan Legislative Yuan API
-#'
-#'@param start_date start_date is inherited from global env.
-#'
-#'@param end_date end_date is inherited from global env.
-#'
-#'@importFrom attempt stop_if_not
-#'@keywords internal
-# api_check <- function(start_date = start_date, end_date = end_date) {
-# attempt::stop_if_all(start_date > as.Date(Sys.time()),
-# isTRUE, msg = "The start date should not be after the system time")
-# attempt::stop_if_all(end_date > as.Date(Sys.time()),
-# isTRUE, msg = "The end date should not be after the system time")
-# attempt::stop_if_all(start_date, is.character, msg = "use numeric format")
-# attempt::stop_if_all(end_date, is.character, msg = "use numeric format")
-# attempt::stop_if_all(start_date, is.null, msg = "start_date is missing")
-# attempt::stop_if_all(end_date, is.null, msg = "end_date is missing")
-# attempt::stop_if_all(end_date > start_date, isFALSE,
-# msg = paste("The start date, ", start_date, ",", " should not be later than the end date, ",
-# end_date, ".", sep = ""))
-# }
-api_check <- function(start_date = start_date, end_date = end_date) {
-
- attempt::stop_if_all(start_date > as.Date(Sys.time()),
- isTRUE, msg = "The start date should not be after the current system time.")
- attempt::stop_if_all(end_date > as.Date(Sys.time()),
- isTRUE, msg = "The end date should not be after the current system time.")
- attempt::stop_if_all(start_date, is.character,
- msg = "Use numeric format for start_date.")
- attempt::stop_if_all(end_date, is.character,
- msg = "Use numeric format for end_date.")
- attempt::stop_if_all(start_date, is.null,
- msg = "The parameter 'start_date' is missing.")
- attempt::stop_if_all(end_date, is.null,
- msg = "The parameter 'end_date' is missing.")
- attempt::stop_if_all(end_date > start_date, isFALSE,
- msg = paste("The start date, ", start_date, ",", " should not be later than the end date, ",
- end_date, ".", sep = ""))
-}
-
-
-#' Transforming Minguo (Taiwan) Calendar to A.D. Calendar I
-#'
-#' @description `transformed_date_meeting()` transforms Minguo (Taiwan) Calendar
-#' to A.D. calendar in POSIXct for `get_meetings()`, `get_caucus_meetings()`,
-#' and `get_speech_video()`,
-#'
-#' @param roc_date Date format in Minguo (Taiwan) calendar (e.g., "105/05/31") as a
-#' string vector
-#'
-#' @return date in POSIXct
-#'
-#' @importFrom stringr str_split_1
-#'
-#' @keywords internal
-#'
-#' @examples
-#' \dontrun{
-#' transformed_date_meeting("105/05/31")
-#' }
-#'
-#' @details `check_date` transforms ROC date to a date in POSIXct, e.g. "105/05/31" to "2016-05-31".
-transformed_date_meeting <- function(roc_date) {
- roc_date <- stringr::str_split_1(roc_date, "/")
- date_ad <- as.Date(as.POSIXct(paste(as.numeric(roc_date[1]) + 1911,
- roc_date[2],
- roc_date[3], sep = "-"),
- origin = "1582-10-14", tz = "GMT"))
- return(date_ad)
-}
-
-
-#' Transforming Minguo (Taiwan) Calendar to A.D. Calendar II
-#'
-#' @description `transformed_date_meeting()` transforms Minguo (Taiwan) Calendar
-#' to A.D. format in POSIXct for `get_bill()`, e.g. "1050531" to "2016-05-31".
-#'
-#' @param roc_date date format in Taiwan ROC calendar (e.g., "1050531") in a character vector
-#'
-#' @return date in POSIXct
-#'
-#' @importFrom stringr str_sub
-#'
-#' @keywords internal
-#'
-#' @examples
-#' \dontrun{
-#' transformed_date_bill("1050531")
-#' }
-transformed_date_bill <- function(roc_date) {
- day <- stringr::str_sub(roc_date, -2, -1)
- month <- stringr::str_sub(roc_date, -4, -3)
- roc_year <- stringr::str_sub(roc_date, 1, nchar(roc_date) - nchar(stringr::str_sub(roc_date, -4, -1)))
- date_ad <- as.Date(as.POSIXct(paste(as.numeric(roc_year) + 1911,
- as.numeric(month),
- as.numeric(day), sep = "-"),
- origin = "1582-10-14", tz = "GMT"))
- return(date_ad)
-}
-
-#' Transforming Minguo (Taiwan) Calendar to A.D. Calendar III
-#'
-#'@description `transformed_date_meeting()` transforms Minguo (Taiwan) Calendar
-#'to A.D. format in POSIXct for `get_bill()`, e.g. "1050531" to "2016-05-31".
-#'
-#'@param roc_date date format in Minguo (Taiwan) Calendar (e.g., "1050531") in a
-#'character vector
-#'
-#'@return date in POSIXct
-#'
-#'@importFrom stringr str_sub
-#'
-#'@keywords internal
-check_date <- function(roc_date) {
- day <- stringr::str_sub(roc_date, -2, -1)
- month <- stringr::str_sub(roc_date, -4, -3)
- roc_year <- stringr::str_sub(roc_date, 1, nchar(roc_date) - nchar(stringr::str_sub(roc_date, -4, -1)))
- date_ad <- as.Date(as.POSIXct(paste(as.numeric(roc_year) + 1911,
- as.numeric(month),
- as.numeric(day), sep = "-"),
- origin = "1582-10-14", tz = "GMT"))
- return(date_ad)
-}
-
-
-#' Transforming Minguo (Taiwan) Calendar to A.D. Calendar IIII
-#'
-#'@description `transformed_date_meeting()` transforms Minguo (Taiwan) Calendar
-#'to A.D. format in POSIXct for `get_bill()`, e.g. "1050531" to "2016-05-31".
-#'
-#'@param roc_date Date format in Minguo (Taiwan) calendar (e.g., "105/05/31") as a
-#'string vector
-#'
-#'@return date in POSIXct
-#'
-#'@importFrom stringr str_split_1
-#'
-#'@keywords internal
-#'
-#' @examples
-#' \dontrun{
-#' check_date2("105/05/31")
-#' }
-#'
-#'@details `check_date` transforms ROC date to a date in POSIXct, e.g. "105/05/31" to "2016-05-31".
-check_date2 <- function(roc_date) {
- roc_date <- stringr::str_split_1(roc_date, "/")
- date_ad <- as.Date(as.POSIXct(paste(as.numeric(roc_date[1]) + 1911,
- roc_date[2],
- roc_date[3], sep = "-"),
- origin = "1582-10-14", tz = "GMT"))
- return(date_ad)
-}
diff --git a/.Rproj.user/763C8F27/sources/session-ab45fd2f/EB94B8C8-contents b/.Rproj.user/763C8F27/sources/session-ab45fd2f/EB94B8C8-contents
deleted file mode 100644
index 176c7239..00000000
--- a/.Rproj.user/763C8F27/sources/session-ab45fd2f/EB94B8C8-contents
+++ /dev/null
@@ -1,95 +0,0 @@
-# Workflow derived from https://github.com/r-lib/actions/tree/v2/examples
-# Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help
-# on:
-# push:
-# branches: [main, master]
-# pull_request:
-# branches: [main, master]
-#
-# name: R-CMD-check
-#
-# jobs:
-# R-CMD-check:
-# runs-on: ${{ matrix.config.os }}
-#
-# name: ${{ matrix.config.os }} (${{ matrix.config.r }})
-#
-# strategy:
-# fail-fast: false
-# matrix:
-# config:
-# - {os: macos-latest, r: 'release'}
-# - {os: windows-latest, r: 'release'}
-# - {os: ubuntu-latest, r: 'devel', http-user-agent: 'release'}
-# - {os: ubuntu-latest, r: 'release'}
-# env:
-# GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
-# R_KEEP_PKG_SOURCE: yes
-#
-# steps:
-# - uses: actions/checkout@v2
-#
-# - uses: r-lib/actions/setup-pandoc@v2
-#
-# - uses: r-lib/actions/setup-r@v2
-# with:
-# r-version: ${{ matrix.config.r }}
-# http-user-agent: ${{ matrix.config.http-user-agent }}
-# use-public-rspm: true
-#
-# - uses: r-lib/actions/setup-r-dependencies@v2
-# with:
-# extra-packages: any::rcmdcheck
-# needs: check
-#
-# - uses: r-lib/actions/check-r-package@v2
-# with:
-# upload-snapshots: true
-
-name: R-CMD-check
-
-jobs:
- R-CMD-check:
- runs-on: ${{ matrix.config.os }}
- name: ${{ matrix.config.os }} (${{ matrix.config.r }})
-
- strategy:
- fail-fast: false
- matrix:
- config:
- - {os: macos-latest, r: 'release'}
- - {os: windows-latest, r: 'release'}
- - {os: ubuntu-latest, r: 'devel', http-user-agent: 'release'}
- - {os: ubuntu-latest, r: 'release'}
-
- env:
- GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
- R_KEEP_PKG_SOURCE: yes
- _R_CHECK_ASCII_CODE_: FALSE
- R_CHECK_IGNORE_ASCII: true
-
- steps:
- - uses: actions/checkout@v3
-
- - uses: r-lib/actions/setup-pandoc@v2
-
- - uses: r-lib/actions/setup-r@v2
- with:
- r-version: ${{ matrix.config.r }}
- http-user-agent: ${{ matrix.config.http-user-agent }}
- use-public-rspm: true
-
- - uses: r-lib/actions/setup-r-dependencies@v2
- with:
- extra-packages: any::rcmdcheck
- needs: check
-
- - uses: r-lib/actions/check-r-package@v2
- env:
- _R_CHECK_ASCII_CODE_: false
- R_CHECK_IGNORE_ASCII: true
- with:
- args: 'c("--no-manual", "--ignore-vignettes")'
- error-on: '"error"'
- upload-snapshots: true
- check-dir: check
diff --git a/.Rproj.user/763C8F27/sources/session-ab45fd2f/ED3373DE-contents b/.Rproj.user/763C8F27/sources/session-ab45fd2f/ED3373DE-contents
deleted file mode 100644
index d944ad0f..00000000
--- a/.Rproj.user/763C8F27/sources/session-ab45fd2f/ED3373DE-contents
+++ /dev/null
@@ -1,5162 +0,0 @@
-的
-把你們
-對你們
-你們自己
-您
-把您
-之
-為
-對您
-您自己
-並
-以
-任
-應
-於
-不
-已行
-鑑於
-日前
-並
-未予
-諸多
-等
-其
-但
-情事
-其
-您們
-未將
-但
-遭
-是
-卻
-爰
-把您們
-對您們
-您們自己
-特向
-他
-把他
-對他
-他自己
-她
-把她
-對她
-她自己
-牠
-把牠
-對牠
-牠自己
-它
-把它
-對它
-它自己
-你們
-把你們
-對你們
-你們自己
-這
-那
-這些
-那些
-該
-這個
-這麼
-這樣
-這是
-我的
-我們的
-你的
-你們的
-他的
-她的
-牠的
-它的
-他們的
-其
-甚麼
-什麼
-哪一
-那一
-哪一個
-那一個
-哪個
-那個
-誰
-誰人
-誰人的
-哪時
-那時
-何時
-幾時
-哪裡
-那裡
-哪裏
-那裏
-哪兒
-那兒
-如何
-為何
-怎樣
-何方
-是
-有
-擁有
-確有
-可能
-應該
-將會
-或能
-未必
-似乎
-說
-表示
-講
-提出
-透露
-陳述
-講述
-報道
-報導
-報告
-匯報
-和
-與
-及
-以及
-兼
-並
-但
-但是
-然而
-而
-而是
-而且
-不過
-如果
-如
-若果
-若
-即使
-假如
-或者
-或
-或是
-還是
-抑或
-換言之
-換句話說
-當時
-也沒有
-也不
-因為
-因
-由於
-所以
-那樣
-那麼
-正是
-同樣地
-大概
-跟
-像
-都很
-直至
-直到
-迄
-曾經
-一度
-以前
-從前
-這地
-這處
-這地方
-這個地方
-那地
-那處
-那地方
-那個地方
-全部
-所有
-完全
-共
-每一
-任何
-都
-皆
-兩者都
-均
-各自
-個別
-彼此
-亦
-少量
-少數
-少
-多
-多數
-大量
-更多
-更大量
-更
-最多
-大多數
-大部份
-最
-極
-極其
-幾乎
-一些
-若干
-部份
-其他
-其餘
-個別
-剩餘
-如此
-如
-因此
-固此
-不
-不是
-非
-否
-沒
-只是
-只
-那末
-那麼
-然後
-也
-太
-過於
-非常
-很
-頗
-的
-屬於
-於
-屬
-之中
-之內
-入
-在
-由
-至
-到
-內
-裡面
-裏面
-給
-為了
-為
-作為
-就
-和
-跟隨
-同
-以
-有
-關於
-對於
-至於
-反對
-對立
-倚
-靠
-關於
-有關
-涉及
-之間
-中間
-期間
-進入
-成為
-轉為
-朝著
-朝着
-通過
-穿越
-由於
-透過
-經
-中
-其中
-前
-之前
-後
-之後
-其後
-上
-之上
-其上
-下
-之下
-其下
-向上
-向下
-在上
-在下
-往上
-往下
-之中
-之外
-其外
-處於
-離
-遠離
-我
-掉
-去掉
-除
-除掉
-靠近
-覆蓋
-過
-我
-從
-多於
-超過
-高於
-根據
-受
-外
-自
-始於
-以防
-以免
-朝
-向
-往
-前往
-對著
-對着
-對
-給
-距
-到
-至
-差
-令
-又
-又一
-再一次
-再
-復
-屢
-更
-進一步
-之外
-此外
-比
-自己的
-獨立地
-獨立的
-本人的
-相同
-同樣
-相同的
-同樣的
-分
-時
-日
-月
-年
-年代
-年份
-年度
-世紀
-早上
-上午
-晚上
-下午
-中午
-為
-並
-等
-多
-
-這部分
-書面報告
-月份
-國內
-什麼樣
-困難
-辛苦
-主管機關
-金額
-講到
-一條
-好嗎
-原則
-注意
-上次
-反對
-兩年
-了嗎
-你講
-放在
-要問
-幾年
-一個月
-好嗎
-還在
-這方面
-實際上
-這件
-一次
-兩個
-我要
-第一個
-幾個
-很大
-再來
-講的
-一年
-第二個
-事實上
-減少
-一件
-是從
-這也
-提高
-目的
-三個
-地區
-有人
-情形
- ok
-多久
-一種
-法治
-佩服
-披露
-分鐘
-關注
-含有
-朝野
-研議
-黨團
-現象
-草案
-審理
-案件
-萬戶
-第三款
-第二款
-本法
-刪除
-入法
-這條
-第十三條
-放進來
-第四項
-所提
-前項
-第四款
-第十六條
-罰則
-要點
-倡議
-值得
-活動
-之內
-擔任
-背景
-議員
-年前
-一邊
-時空
-經歷
-時代
-十幾年
-正面
-人有
-固定
-卡住
-某種程度
-挑戰
-教育部
-教育
-違反
-質疑
-改善
-鼓勵
-成立
-活動
-實話
-成效
-指標
-達成
-效益
-效果
-會要
-評比
-不彰
-成績
-相比
-五成
-四成
-低於
-六成
-相較
-看不到
-表格
-考核
-會來
-上路
-國際
-年限
-可能性
-涵蓋到
-避免掉
-公司
-呈現
-開放
-表達
-活動
-頻率
-權益
-改善
-申訴
-移除
-預計
-訊息
-原本
-完整
-持續
-分析
-試辦
-確認
-利用
-協助
-落實
-一併
-釐清
-提升
-落實
-釐清
-國外
-服務
-協助
-面臨
-推進
-突破
-角色
-新增
-採取
-產業
-企業
-明年
-立法
-第一線
-程序
-涉及到
-就教
-照顧
-對象
-風險
-配套
-也許
-結束
-期待
-接近
-差異
-關切
-講白
-情勢
-預期
-垂詢
-歷史
-在一起
-員工
-後續
-實話
-平臺
-給予
-角度
-業者
-設置
-想法
-接近
-麻煩
-法制
-實話
-有限
-感謝
-報備
-變更
-建請
-爬梳
-核定
-譬如說
-第幾
-初步
-顯示
-no
-提早
-不應該
-外面
-不然
-清清楚楚
-萬一
-廢掉
-改為
-爆發
-對了
-一點點
-假設
-第一百六十五
-任內
-其餘
-形同
-一致
-統統
-談到
-僅有
-作出
-幹什麼
-像是
-理想
-不到
-三成
-第四
-有無
-點出
-左邊
-旁邊
-養成
-尚未
-得以
-單一
-現況
-實施
-階段
-正確
-占用
-背後
-詢問
-選擇
-進到
-認不
-不等
-力道
-宣傳
-核心
-一但
-三分之一
-推給
-得以
-促使
-一旦
-形同
-希望
-儘快
-國人
-檢討
-概括
-推展
-回應
-需求
-之間
-前天
-四十多
-幾十
-原因
-拿掉
-不一定
-不錯
-等一下
-認定
-牽扯到
-還可以
-平常
-副部長
-送到
-數據
-贊成
-委員長
-官員
-怎麼辦
-注意到
-參加
-不然
-考量
-平常
-世界
-能力
-例子
-不好
-好幾
-平常
-重點
-好了
-奇怪
-說清楚
-不好意思
-動議
-慢慢
-期間
-評估
-負責
-因應
-配合
-透過
-思考
-原因
-之外
-規劃
-保護
-東西
-沒辦法
-搞不好
-立場
-看法
-明定
-早上
-放心
-百分之百
-列席
-能不能
-動作
-東西
-因應
-碰到
-成果
-力量
-交給
-百分之
-體系
-關係
-績效
-承受
-投資
-努力
-胡說八道
-提醒
-合作
-一般
-盤點
-建立
-情況
-怎麼樣
-流程
-sop
-即時
-回報
-疑似
-裡頭
-強化
-思維
-分享
-面向
-永續
-新興
-論述
-實踐
-投入
-學習
-關鍵
-民間
-聚焦
-最新
-一頁
-三千多
-幾億元
-花錢
-三百多
-一百多
-五千
-年時
-早就
-有錢
-兩千多
-二級
-一級
-四級
-等級
-同一個
-列為
-姓名
-三次
-第一級
-討論一下
-編號
-一毛錢
-測試
-第二階段
-第一階段
-一套
-五個
-四大
-面向
-五大
-第四個
-失敗
-法源
-規則
-命令
-制定
-預告
-修訂
-遵守
-指引
-準則
-函釋
-放寬
-可行
-修改
-算不算
-困擾
-多少錢
-這段
-度過
-所提
-模糊
-現有
-放到
-適度
-回歸到
-做過
-幾位
-不太
-前提
-提過
-不算
-徵詢
-引發
-備查
-空白
-修改
-完備
-表格
-做過
-幾項
-浪費
-退回
-六個
-三項
-第三階段
-多月
-出錢
-六百多
-拿來
-四百多
-估算
-九百多
-億多
-老百姓
-客氣
-老實
-一遍
-聽不懂
-坐在
-再講
-長官
-講完
-生氣
-喜歡
-講過
-不讓
-欺負
-哪有
-樣子
-嘴巴
-多億元
-時代
-打造
-裡頭
-不見
-速度
-時代
-團隊
-成功
-效率
-挑戰
-快速
-加快
-腳步
-加油
-太慢
-有效率
-這段
-期許
-成績
-跟上
-展現
-魄力
-一律
-第二十三條
-愈來愈
-印象
-處置
-還會
-追蹤
-日才
-一套
-日到
-小心
-關掉
-謹慎
-請教部長
-知不知道
-可不可以
-面對
-預算
-做好
-面對
-卻是
-講過
-為例
-控管
-緊張
-離譜
-憂心
-應對
-行政部門
-難過
-全力支持
-害怕
-恐慌
-還好
-恐怖
-全世界
-好不容易
-這回
-地氣
-功課
-嚴肅
-了解
-瞭解
-不用
-坦白
-管理
-設立
-類型
-分類
-型態
-兩種
-區分
-樣態
-類別
-層次
-分成
-一類
-現有
-三種
-找到
-強度
-衝突
-簡單
-案子
-組織
-學者
-邀請
-專家學者
-諮詢
-人士
-開過
-出席
-幾位
-對話
-各方
-先進
-在場
-蒐集
-這場
-責任
-會議
-機制
-種種
-好不好
-基金
-業務
-影響
-一些
-召委
-概念
-人數
-民眾
-一直
-文化
-質詢
-老師
-期程
-有沒有
-資源
-特別
-理解
-目標
-包括
-數字
-解決
-解釋
-去年
-人才
-委員會
-法律
-費用
-請教
-同仁
-告訴
-方法
-小時
-承諾
-事件
-作業
-關心
-網站
-項目
-監督
-哪裡
-機構
-方案
-經費
-中央
-廣告
-特聘
-舉辦
-公開
-連結
-提供給
-教學
-設計
-蔣乃辛
-設計成
-職司
-凸顯出來
-字體
-顯現
-拉扯
-星期六
-評定
-拆開
-北區
-折衷
-壓縮
-正反
-廣場
-推動到
-美感
-評鑑
-身兼
-創新
-瀏覽
-標的
-提撥
-派員
-信用
-重頭戲
-總機
-瀏覽量
-開放型
-財務
-後年
-模擬
-擔子
-中段班
-掛名
-規模
-細目
-登記
-酌凍
-報紙
-儘量
-理論
-予以
-壓力
-詳細
-保留
-既有
-變化
-提供給
-精進
-實務
-做為
-課發
-經費
-經驗
-大幅
-會期
-辦公室
-會不會
-調整
-事實
-資產
-收據
-承辦人
-帶隊
-簡短
-列入
-人次
-那麼多
-第二
-點半
-解釋
-窗口
-修復
-何況
-開發
-考察
-簡化
-即可
-多麼
-透明
-信任
-太少
-一點
-背負
-史無前例
-一共
-負擔
-發言
-整理
-藉著
-專家
-未及
-源於
-囿於
-平民
-答請
-百姓
-快答
-請教
-捫心自問
-質詢部長
-辯論
-新一代
-會場
-放棄
-鄉親
-難處
-打開
-附帶
-漂亮
-提出來
-規格
-指示
-機器
-考察
-終於
-位置
-心情
-說到
-那裡
-細節
-沒關係
-立法院
-發現
-監督
-回到
-關心
-第三
-第六十四
-出售
-盜賣
-擾亂
-席方
-跟進
-張數
-席謹
-上百萬
-高中
-光榮
-接受到
-專精
-披上
-外界
-哪裡
-專案型
-外部
-受罰
-惡言
-生產
-批准
-依賴
-同仁
-費用
-增額
-收到
-席實
-發動權
-太多
-統合到
-元年
-過往
-媒合
-納入
-雞湯
-法條
-打平
-上口
-急切
-眼花
-倒退
-排行榜
-群體
-密語
-事物
-品項
-準備好
-詢問到
-小組
-危險
-副校長
-改革
-評決
-趕工
-專章
-調閱
-星期五
-之所在
-本份
-因素
-嫻熟
-標註
-規範到
-打平
-利益
-例外
-職缺
-條件
-設計
-方便度
-團體
-人力
-名片
-工廠
-發源地
-依法
-養出
-經濟
-片段
-煩惱
-子產業
-技術
-太空
-養菜蟲
-升格
-核備
-決心
-區分出來
-中央
-名稱
-期程
-有沒有
-資源
-特別
-理解
-目標
-委辦
-手段
-用以
-一口氣
-五千多
-風波
-充份
-萬言書
-動用到
-六千多萬
-改成
-下午
-揭露出來
-不出
-錯亂
-阻擋
-翻轉
-點點
-場面
-無意義
-打算
-不然
-最終
-免於
-說法
-接到
-改成
-在座
-一審
-基礎
-深深
-分區
-挑出
-總共
-放進去
-ok
-不然
-至少
-十幾
-結論
-作法
-所有人
-處理好
-彈性
-適合
-擔心
-溝通
-訂定
-朋友
-回來
-暴力
-機會
-撐過來
-民國
-比例
-定義
-幹嘛
-說出來
-不可能
-不好
-習慣
-第五
-扯後腿
-漠視
-刁難
-無能
-包含
-產品
-認定為
-回去
-協調
-不可以
-辦理
-辦過
-辦理
-好處
-儘速
-聲音
-及早
-副主委
-探討
-接受
-程度
-操作
-現實
-統合
-年費
-稱讚
-拜託
-週期
-
-承辦
-核銷
-更新
-查核
-補充
-迫切性
-重跑
-緣故
-第二
-必要性
-不厭其煩
-診斷
-點半
-輔助
-繁瑣
-落後
-請求
-篇幅
-務必
-資訊
-俾利
-沈積
-當初
-設計出來
-細瑣
-整體
-取消
-繞到
-帳棚
-筆劃
-訪客
-收銀
-擁有
-基準
-規劃好
-
-啟動
-措施
-日期
-精熟
-催促
-開啟
-升等
-裁示
-時效
-兩難
-在地
-公文
-做成
-責備錯
-右下角
-閱報
-文案
-聯展
-傳聲筒
-方式
-確實
-修正
-申請
-資訊
-實驗
-這麼多
-決議
-代表
-機會
-發展
-調查
-回答
-想要
-書面
-建設
-改變
-通案
-配置
-第十五
-處長
-解凍
-許久
-建議
-臨時
-參考
-邏輯
-保存
-檢核
-台灣
-改進
-請問
-你我
-學生
-臺灣
-裡面
-執行
-更多
-標準
-人員
-機關
-現場
-拿出來
-乘以
-不行
-明明
-double
-相關
-主管
-建議
-推動
-謝謝
-生活
-國民
-文字
-尊嚴
-福利
-條文
-符合
-人性
-第十六
-比率
-越來越
-系統
-足夠
-提供
-現行
-保障
-論點
-1.0
-0.8
-0.6
-0.4
-0.2
-0.0
-告知
-單位
-複雜
-賣給
-合約
-議題
-文件
-實在
-公布
-過程
-修法
-實質
-案例
-膨脹
-電郵
-執掌
-審議
-鬼打牆
-我國
-物力
-明白
-環境
-1.0
-0.8
-0.6
-0.4
-0.2
-0.0
-原地
-內容
-專業
-條例
-爭議
-參與
-挫敗
-雨露均霑
-男生
-領域
-行政院
-男性
-健全
-法令
-禮拜
-法規
-1.0
-0.8
-0.6
-0.4
-0.2
-0.0
-編列
-補助
-提案
-我覺
-這裡
-社會
-增加
-同意
-工作
-億元
-委員
-政策
-提到
-一定
-意見
-辦法
-主席
-國家
-地方
-中心
-發生
-狀況
-報告
-制度
-第一
-主委
-真的
-研究
-一樣
-支持
-資料
-一下
-事情
-萬元
-態度
-審查
-政府
-未來
-方向
-時間
-協會
-版本
-我們
-這個
-可以
-所以
-部長
-就是
-部分
-問題
-這樣
-其實
-一個
-因為
-如果
-本席
-大家
-什麼
-計畫
-應該
-今天
-你們
-現在
-但是
-討論
-這是
-提出
-認為
-非常
-剛剛
-一
-好像
-昨天
-等於
-拿到
-這樣子
-要不要
-大部分
-不能夠
-立委
-算是
-涉及
-好好
-到時候
-曉得
-觀念
-事項
-列出
-一方面
-之下
-一一
-反正
-各式各樣
-聽到
-立法委員
-本來
-感覺
-一半
-列出來
-形容詞
-超過
-聽起來
-有時候
-院長
-署長
-部長
-次長
-司長
-局長
-副局長
-一起
-行政
-問到
-導致
-一陣子
-部會
-
-!
-"
-#
-$
-%
-&
-'
-(
-)
-*
-+
-,
--
---
-.
-..
-...
-......
-...................
-./
-.壹
-.數
-.日
-/
-//
-\n
-0
-1
-2
-3
-4
-5
-6
-7
-8
-9
-:
-://
-::
-;
-<
-=
->
->>
-?
-@
-A
-Lex
-[
-\
-]
-^
-_
-`
-exp
-sub
-sup
-|
-}
-~
-~~~~
-·
-×
-×××
-Δ
-Ψ
-γ
-μ
-φ
-φ.
-В
-—
-——
-———
-‘
-’
-’‘
-“
-”
-”,
-…
-……
-…………………………………………………③
-′∈
-′|
-℃
-Ⅲ
-↑
-→
-∈[
-∪φ∈
-≈
-①
-②
-②c
-③
-③]
-④
-⑤
-⑥
-⑦
-⑧
-⑨
-⑩
-──
-■
-▲
-●
-✩
-★
-✦
-▀
-▁
-▂
-▃
-▄
-▅
-▆
-▇
-█
-▉
-▊
-▋
-▋
-▌
-▍
-▎
-▏
-▐
-░
-▒
-▓
-▔
-□
-▢
-▣
-▤
-▥
-▦
-▧
-▨
-▩
-▪
-▫
-▬
-▭
-▮
-▯
-▰
-▱
-◆
-◇
-◈
-◘
-◙
-◚
-◛
-◧
-◨
-◩
-◪
-◫
-⭔
-⭓
-◊
-▖
-▗
-▘
-▙
-▚
-▛
-▜
-▝
-▞
-▟
-◰
-◱
-◲
-◳
-↕
-↖
-↗
-↘
-↙
-↚
-↛
-↜
-↝
-↞
-↟
-↠
-↡
-↢
-↣
-↤
-↥
-↦
-↧
-↨
-↩
-↪
-↫
-↬
-↭
-↮
-↯
-↰
-↱
-↲
-↳
-↴
-↶
-↷
-↸
-↹
-↺
-↻
-⟳
-↼
-↽
-↾
-↿
-⇀
-⇁
-⇂
-⇃
-⇄
-⇅
-⇆
-⇇
-⇈
-⇉
-⇊
-⇋
-⇌
-⇍
-⇎
-⇏
-⇕
-⇖
-⇗
-⇘
-⇙
-⇚
-⇛
-⇜
-⇝
-⇞
-⇟
-⇠
-⇡
-⇢
-⇣
-⇤
-⇥
-⇦
-⇧
-⇨
-⇩
-⇪
-⌅
-⌆
-⌤
-⏎
-▶
-☇
-☈
-➔
-➘
-➙
-➚
-➛
-➜
-➝
-➞
-➟
-➠
-➡
-➢
-➣
-➤
-➥
-➦
-➧
-➨
-➩
-➪
-➫
-➬
-➭
-➮
-➯
-➱
-➲
-➳
-➴
-➵
-➶
-➷
-➸
-➹
-➺
-➻
-➼
-➽
-➾
-⤴
-⤵
-↵
-↓
-↔
-←
-→
-↑
-⍇
-⍈
-⍐
-⍗
-⇫
-⇬
-⇭
-⇮
-⇯
-⇰
-⇱
-⇲
-⇳
-⇴
-⇵
-⇶
-⇷
-⇸
-⇹
-⇺
-⇻
-⇼
-⇽
-⇾
-⇿
-⇐
-⇑
-⇒
-⇓
-⇔
-➡
-⬅
-⬇
-⬆
-↖
-↙
-↘
-↗
-🔄
-🔀
-↔
-↕
-⤴
-🔃
-↩
-↪
-◀
-▶
-🔁
-⤵
-⏬
-⏫
-🔽
-🔼
-👉
-👈
-👇
-👆
-⊿
-▲
-△
-▴
-▵
-▶
-▷
-▸
-▹
-►
-▻
-▼
-▽
-▾
-▿
-◀
-◁
-◂
-◃
-◄
-◅
-◢
-◣
-◤
-◥
-◬
-◭
-◮
-◸
-◹
-◺
-◿
-∇
-∆
-ˍ
-‐
-⎯
-‒
-―
-─
-━
-│
-┃
-┄
-┅
-┆
-┇
-┈
-┉
-┊
-┋
-╌
-╍
-╎
-╴
-╵
-╶
-╷
-╸
-╹
-╺
-╻
-╼
-╽
-╾
-╿
-▏
-▕
-╏
-–
-—
-⌜
-⌝
-⌞
-⌟
-┌
-┍
-┎
-┏
-┐
-┑
-┒
-┓
-└
-└
-┕
-┖
-┗
-┘
-┙
-┚
-┛
-├
-├
-┝
-┞
-┟
-┠
-┡
-┢
-┣
-┤
-┥
-┦
-┧
-┨
-┩
-┪
-┫
-┬
-┭
-┮
-┯
-┰
-┱
-┲
-┳
-┴
-┵
-┶
-┷
-┸
-┹
-┺
-┻
-┼
-┽
-┾
-┿
-╀
-╁
-╂
-╃
-╄
-╅
-╆
-╇
-╈
-╉
-╊
-╋
-═
-║
-╒
-╓
-╔
-╔
-╔
-╕
-╕
-╖
-╖
-╗
-╗
-╘
-╙
-╚
-╚
-╛
-╛
-╜
-╜
-╝
-╝
-╞
-╟
-╟
-╠
-╡
-╡
-╢
-╢
-╣
-╣
-╤
-╤
-╥
-╥
-╦
-╦
-╧
-╧
-╨
-╨
-╩
-╩
-╪
-╪
-╫
-╬
-╱
-╲
-╳
-╭
-╮
-╯
-╰
-◜
-◝
-◞
-◟
-◠
-◡
-⌈
-⌊
-⌉
-⌋
-⎛
-⎝
-⎞
-⎠
-⎡
-⎣
-⎤
-⎦
-⎧
-⎩
-⎫
-⎭
-⎸
-⎹
-⎾
-⎿
-⏉
-⏊
-⏋
-⏌
-≡
-≣
-☰
-☱
-☲
-☳
-☴
-☵
-☶
-☷
-⊖
-⊘
-⊙
-⊚
-⊛
-⊜
-⊝
-◉
-○
-◌
-◍
-◎
-●
-◐
-◑
-◒
-◓
-◔
-◕
-◖
-◗
-◦
-◯
-◴
-◵
-◶
-◷
-❍
-⦿
-⊕
-⊗
-•
-·
-∙
-⊙
-⊚
-⊛
-◉
-○
-◌
-◍
-◎
-●
-◘
-◦
-。
-☉
-⦾
-⦿
-⁃
-⁌
-⁍
-◆
-◇
-◈
-★
-☆
-■
-□
-☐
-☑
-☒
-✓
-✔
-❖
-⋄
-❥
-❧
-☙
-☸
-✤
-✱
-✲
-✦
-✧
-↠
-↣
-↦
-↬
-⇛
-⇝
-⇢
-⇨
-➔
-➙
-➛
-➜
-➝
-➞
-➟
-➠
-➡
-➢
-➣
-➤
-➥
-➦
-➧
-➨
-➮
-➱
-➲
-➳
-➵
-➸
-➼
-➽
-➾
-→
-⇾
-⇒
-‣
-▶
-▷
-▸
-▹
-►
-▻
-⣿
-⠿
-⠾
-⠽
-⠼
-⠻
-⠺
-⠹
-⠸
-⠷
-⠶
-⠵
-⠴
-⠳
-⠲
-⠱
-⠰
-⠯
-⠮
-⠭
-⠬
-⠫
-⠪
-⠩
-⠨
-⠧
-⠦
-⠥
-⠤
-⠣
-⠢
-⠡
-⠠
-⠟
-⠞
-⠝
-⠜
-⠛
-⠚
-⠙
-⠘
-⠗
-⠖
-⠕
-⠔
-⠓
-⠒
-⠑
-⠐
-⠏
-⠎
-⠍
-⠌
-⠋
-⠊
-⠉
-⠈
-⠇
-⠆
-⠅
-⠄
-⠃
-⠂
-⠁
-⠀
-∟
-∬
-∭
-∮
-∵
-∷
-≦
-≧
-≋
-╳
-✕
-✖
-✚
-﹢
-﹣
-﹤
-﹥
-%
-+
--
-/
-=
-∧
-∠
-∩
-∪
-°
-÷
-≡
-≥
-∞
-∫
-≤
-≠
-∨
-‰
-‱
-⊥
-π
-±
-√
-∑
-∴
-×
-¬
-Ⅰ
-Ⅱ
-Ⅲ
-Ⅳ
-Ⅴ
-Ⅵ
-Ⅶ
-Ⅷ
-Ⅸ
-Ⅹ
-Ⅺ
-Ⅻ
-ⅰ
-ⅱ
-ⅲ
-ⅳ
-ⅴⅵ
-ⅶ
-ⅷ
-ⅸ
-ⅹ
-ⅺ
-ⅻ
-⓪
-①
-②
-③
-④
-⑤
-⑥
-⑦
-⑧
-⑨
-⑩
-⓵
-⓶
-⓷
-⓸
-⓹
-⓺
-⓻
-⓼
-⓽
-⓾
-⑴
-⑵
-⑶
-⑷
-⑸
-⑹
-⑺
-⑻
-⑼
-⑽
-⓿
-❶
-❷
-❸
-❹
-❺
-❻
-❼
-❽
-❾
-❿
-㈠
-㈡
-㈢
-㈣
-㈤
-㈥
-㈦
-㈧
-㈨
-㈩
-㊀
-㊁
-㊂
-㊃
-㊄
-㊅
-㊆
-㊇
-㊈
-㊉
-0
-1
-2
-3
-4
-5
-6
-7
-8
-9
-
-、
-。
-〈
-〉
-《
-》
-》),
-」
-『
-』
-【
-】
-〔
-〕
-〕〔
-㈧
-壹
-壹.
-壹壹
-壹下
-壹個
-壹些
-壹何
-壹切
-壹則
-壹則通過
-壹天
-壹定
-壹方面
-壹旦
-壹時
-壹來
-壹樣
-壹次
-壹片
-壹番
-壹直
-壹致
-壹般
-壹起
-壹轉眼
-壹邊
-壹面
-七
-萬壹
-三
-三天兩頭
-三番兩次
-三番五次
-上
-上下
-上升
-上去
-上來
-上述
-上面
-下
-下列
-下去
-下來
-下面
-不
-不壹
-不下
-不久
-不了
-不亦樂乎
-不僅
-不僅...而且
-不僅僅
-不僅僅是
-不會
-不但
-不但...而且
-不光
-不免
-不再
-不力
-不單
-不變
-不只
-不可
-不可開交
-不可抗拒
-不同
-不外
-不外乎
-不夠
-不大
-不如
-不妨
-不定
-不對
-不少
-不盡
-不盡然
-不巧
-不已
-不常
-不得
-不得不
-不得了
-不得已
-不必
-不怎麽
-不怕
-不惟
-不成
-不拘
-不擇手段
-不敢
-不料
-不斷
-不日
-不時
-不是
-不曾
-不止
-不止壹次
-不比
-不消
-不滿
-不然
-不然的話
-不特
-不獨
-不由得
-不知不覺
-不管
-不管怎樣
-不經意
-不勝
-不能
-不能不
-不至於
-不若
-不要
-不論
-不起
-不足
-不過
-不叠
-不問
-不限
-與
-與其
-與其說
-與否
-與此同時
-專門
-且
-且不說
-且說
-兩者
-嚴格
-嚴重
-個
-個人
-個別
-中小
-中間
-豐富
-串行
-臨
-臨到
-為
-為主
-為了
-為什麽
-為什麼
-為何
-為止
-為此
-為著
-主張
-主要
-舉凡
-舉行
-乃
-乃至
-乃至於
-麽
-之
-之壹
-之前
-之後
-之後
-之所以
-之類
-烏乎
-乎
-乒
-乘
-乘勢
-乘機
-乘勝
-乘虛
-乘隙
-九
-也
-也好
-也就是說
-也是
-也罷
-了
-了解
-爭取
-二
-二來
-二話不說
-二話沒說
-於
-於是
-於是乎
-雲雲
-雲爾
-互
-互相
-五
-些
-交口
-亦
-產生
-親口
-親手
-親眼
-親自
-親身
-人
-人人
-人們
-人家
-人民
-什麽
-什麽樣
-什麼
-僅
-僅僅
-今
-今後
-今天
-今年
-今後
-介於
-仍
-仍舊
-仍然
-從
-從不
-從嚴
-從中
-從事
-從今以後
-從優
-從古到今
-從古至今
-從頭
-從寬
-從小
-從新
-從無到有
-從早到晚
-從未
-從來
-從此
-從此以後
-從而
-從輕
-從速
-從重
-他
-他人
-他們
-他是
-他的
-代替
-以
-以上
-以下
-以為
-以便
-以免
-以前
-以及
-以後
-以外
-以後
-以故
-以期
-以來
-以至
-以至於
-以致
-們
-任
-任何
-任憑
-任務
-企圖
-夥同
-會
-偉大
-傳
-傳說
-傳聞
-似乎
-似的
-但
-但凡
-但願
-但是
-何
-何樂而不為
-何以
-何況
-何處
-何妨
-何嘗
-何必
-何時
-何止
-何苦
-何須
-余外
-作為
-妳
-妳們
-妳是
-妳的
-使
-使得
-使用
-例如
-依
-依據
-依照
-依靠
-便
-便於
-促進
-保持
-保管
-保險
-俺
-俺們
-倍加
-倍感
-倒不如
-倒不如說
-倒是
-倘
-倘使
-倘或
-倘然
-倘若
-借
-借以
-借此
-假使
-假如
-假若
-偏偏
-做到
-偶爾
-偶而
-儻然
-像
-兒
-允許
-元/噸
-充其極
-充其量
-充分
-先不先
-先後
-先後
-先生
-光
-光是
-全體
-全力
-全年
-全然
-全身心
-全部
-全都
-全面
-八
-八成
-公然
-六
-兮
-共
-共同
-共總
-關於
-其
-其壹
-其中
-其二
-其他
-其余
-其後
-其它
-其實
-其次
-具體
-具體地說
-具體來說
-具體說來
-具有
-兼之
-內
-再
-再其次
-再則
-再有
-再次
-再者
-再者說
-再說
-冒
-沖
-決不
-決定
-決非
-況且
-準備
-湊巧
-凝神
-幾
-幾乎
-幾度
-幾時
-幾番
-幾經
-凡
-凡是
-憑
-憑借
-出
-出於
-出去
-出來
-出現
-分別
-分頭
-分期
-分期分批
-切
-切不可
-切切
-切勿
-切莫
-則
-則甚
-剛
-剛好
-剛巧
-剛才
-初
-別
-別人
-別處
-別是
-別的
-別管
-別說
-到
-到了兒
-到處
-到頭
-到頭來
-到底
-到目前為止
-前後
-前此
-前者
-前進
-前面
-加上
-加之
-加以
-加入
-加強
-動不動
-動輒
-勃然
-匆匆
-十分
-千
-千萬
-千萬千萬
-半
-單
-單單
-單純
-即
-即令
-即使
-即便
-即刻
-即如
-即將
-即或
-即是說
-即若
-卻
-卻不
-歷
-原來
-去
-又
-又及
-及
-及其
-及時
-及至
-雙方
-反之
-反之亦然
-反之則
-反倒
-反倒是
-反應
-反手
-反映
-反而
-反過來
-反過來說
-取得
-取道
-受到
-變成
-古來
-另
-另壹個
-另壹方面
-另外
-另悉
-另方面
-另行
-只
-只當
-只怕
-只是
-只有
-只消
-只要
-只限
-叫
-叫做
-召開
-叮咚
-叮當
-可
-可以
-可好
-可是
-可能
-可見
-各
-各個
-各人
-各位
-各地
-各式
-各種
-各級
-各自
-合理
-同
-同壹
-同時
-同樣
-後
-後來
-後者
-後面
-向
-向使
-向著
-嚇
-嗎
-否則
-吧
-吧噠
-吱
-呀
-呃
-呆呆地
-吶
-嘔
-唄
-嗚
-嗚呼
-呢
-周圍
-呵
-呵呵
-呸
-呼哧
-呼啦
-咋
-和
-咚
-咦
-咧
-咱
-咱們
-咳
-哇
-哈
-哈哈
-哉
-哎
-哎呀
-哎喲
-嘩
-嘩啦
-喲
-哦
-哩
-哪
-哪個
-哪些
-哪兒
-哪天
-哪年
-哪怕
-哪樣
-哪邊
-哪裏
-哼
-哼唷
-唉
-唯有
-啊
-啊呀
-啊哈
-啊喲
-啐
-啥
-啦
-啪達
-啷當
-喀
-餵
-喏
-喔唷
-嘍
-嗡
-嗡嗡
-嗬
-嗯
-噯
-嘎
-嘎嘎
-嘎登
-噓
-嘛
-嘻
-嘿
-嘿嘿
-四
-因
-因為
-因了
-因此
-因著
-因而
-固
-固然
-在
-在下
-在於
-地
-均
-堅決
-堅持
-基於
-基本
-基本上
-處在
-處處
-處理
-復雜
-多
-多麽
-多虧
-多多
-多多少少
-多多益善
-多少
-多年前
-多年來
-多數
-多次
-夠瞧的
-大
-大不了
-大舉
-大事
-大體
-大體上
-大凡
-大力
-大多
-大多數
-大大
-大家
-大張旗鼓
-大批
-大抵
-大概
-大略
-大約
-大致
-大都
-大量
-大面兒上
-失去
-奇
-奈
-奮勇
-她
-她們
-她是
-她的
-好
-好在
-好的
-好象
-如
-如上
-如上所述
-如下
-如今
-如何
-如其
-如前所述
-如同
-如常
-如是
-如期
-如果
-如次
-如此
-如此等等
-如若
-始而
-姑且
-存在
-存心
-孰料
-孰知
-寧
-寧可
-寧願
-寧肯
-它
-它們
-它們的
-它是
-它的
-安全
-完全
-完成
-定
-實現
-實際
-宣布
-容易
-密切
-對
-對於
-對應
-對待
-對方
-對比
-將
-將才
-將要
-將近
-小
-少數
-爾
-爾後
-爾爾
-爾等
-尚且
-尤其
-就
-就地
-就是
-就是了
-就是說
-就此
-就算
-就要
-盡
-盡可能
-盡如人意
-盡心盡力
-盡心竭力
-盡快
-盡早
-盡然
-盡管
-盡管如此
-盡量
-局外
-居然
-屆時
-屬於
-屢
-屢屢
-屢次
-屢次三番
-豈
-豈但
-豈止
-豈非
-川流不息
-左右
-巨大
-鞏固
-差壹點
-差不多
-己
-已
-已矣
-已經
-巴
-巴巴
-帶
-幫助
-常
-常常
-常言說
-常言說得好
-常言道
-平素
-年復壹年
-並
-並不
-並不是
-並且
-並排
-並無
-並沒
-並沒有
-並肩
-並非
-廣大
-廣泛
-應當
-應用
-應該
-庶乎
-庶幾
-開外
-開始
-開展
-引起
-弗
-彈指之間
-強烈
-強調
-歸
-歸根到底
-歸根結底
-歸齊
-當
-當下
-當中
-當兒
-當前
-當即
-當口兒
-當地
-當場
-當頭
-當庭
-當時
-當然
-當真
-當著
-形成
-徹夜
-徹底
-彼
-彼時
-彼此
-往
-往往
-待
-待到
-很
-很多
-很少
-後來
-後面
-得
-得了
-得出
-得到
-得天獨厚
-得起
-心裏
-必
-必定
-必將
-必然
-必要
-必須
-快
-快要
-忽地
-忽然
-怎
-怎麽
-怎麽辦
-怎麽樣
-怎奈
-怎樣
-怎麼
-怕
-急匆匆
-怪
-怪不得
-總之
-總是
-總的來看
-總的來說
-總的說來
-總結
-總而言之
-恍然
-恐怕
-恰似
-恰好
-恰如
-恰巧
-介入
-職務
-規範
-預估
-公告
-增補
-恰恰
-恰恰相反
-恰逢
-您
-您們
-類似
-檢查
-您是
-惟其
-慣常
-意思
-憤然
-願意
-慢說
-成為
-成年
-成本
-成年累月
-成心
-涉及到
-我
-我們
-我是
-我的
-或
-或則
-或多或少
-或是
-或曰
-或者
-或許
-戰鬥
-截然
-截至
-所
-所以
-所在
-所幸
-所有
-所謂
-才
-才能
-撲通
-打
-打從
-打開天窗說亮話
-擴大
-把
-抑或
-抽冷子
-攔腰
-拿
-按
-按時
-按期
-按照
-按理
-按說
-挨個
-挨家挨戶
-挨次
-挨著
-挨門挨戶
-挨門逐戶
-換句話說
-換言之
-據
-據實
-據悉
-據我所知
-據此
-據稱
-據說
-掌握
-接下來
-接著
-接著
-接連不斷
-放量
-故
-故意
-故此
-故而
-敞開兒
-敢
-敢於
-敢情
-數/
-整個
-斷然
-方
-方便
-方才
-方能
-方面
-旁人
-無
-無寧
-無法
-無論
-既
-既...又
-既往
-既是
-既然
-日復壹日
-日漸
-日益
-日臻
-日見
-時候
-昂然
-明顯
-明確
-是
-是不是
-是以
-是否
-是的
-顯然
-顯著
-普通
-普遍
-暗中
-暗地裏
-暗自
-更
-更為
-更加
-更進壹步
-曾
-曾經
-替
-替代
-最
-最後
-最大
-最好
-最後
-最近
-最高
-有
-有些
-有關
-有利
-有力
-有及
-有所
-有效
-有時
-有點
-有的
-有的是
-有著
-有著
-望
-朝
-朝著
-末##末
-本
-本人
-本地
-本著
-本身
-權時
-來
-來不及
-來得及
-來看
-來著
-來自
-來講
-來說
-極
-極為
-極了
-極其
-極力
-極大
-極度
-極端
-構成
-果然
-果真
-某
-某個
-某些
-某某
-根據
-根本
-格外
-梆
-概
-次第
-歡迎
-歟
-正值
-正在
-正如
-正巧
-正常
-正是
-此
-此中
-此後
-此地
-此處
-此外
-此時
-此次
-此間
-殆
-毋寧
-每
-每個
-每天
-每年
-每當
-每時每刻
-每每
-每逢
-比
-比及
-比如
-比如說
-比方
-比照
-比起
-比較
-畢竟
-毫不
-毫無
-毫無例外
-毫無保留地
-汝
-沙沙
-沒
-沒奈何
-沒有
-沿
-沿著
-註意
-活
-深入
-清楚
-滿
-滿足
-漫說
-焉
-然
-然則
-然後
-然後
-然而
-照
-照著
-牢牢
-特別是
-特殊
-特點
-猶且
-猶自
-獨
-獨自
-猛然
-猛然間
-率爾
-率然
-現代
-現在
-理應
-理當
-理該
-瑟瑟
-甚且
-甚麽
-甚或
-甚而
-甚至
-甚至於
-用
-用來
-甫
-甭
-由
-由於
-由是
-由此
-由此可見
-略
-略為
-略加
-略微
-白
-白白
-的
-的確
-的話
-皆可
-目前
-直到
-直接
-相似
-相信
-相反
-相同
-相對
-相對而言
-相應
-相當
-相等
-省得
-看
-看上去
-看出
-看到
-看來
-看樣子
-看看
-看見
-看起來
-真是
-真正
-眨眼
-著
-著呢
-矣
-矣乎
-矣哉
-知道
-砰
-確定
-碰巧
-社會主義
-離
-種
-積極
-移動
-究竟
-窮年累月
-突出
-突然
-竊
-立
-立刻
-立即
-立地
-立時
-立馬
-竟
-竟然
-竟而
-第
-第二
-等
-等到
-等等
-策略地
-簡直
-簡而言之
-簡言之
-管
-類如
-粗
-精光
-緊接著
-累年
-累次
-純
-純粹
-縱
-縱令
-縱使
-縱然
-練習
-組成
-經
-經常
-經過
-結合
-結果
-給
-絕
-絕不
-絕對
-絕非
-絕頂
-繼之
-繼後
-繼續
-繼而
-維持
-綜上所述
-縷縷
-罷了
-老
-老大
-老是
-老老實實
-考慮
-者
-而
-而且
-而況
-而又
-而後
-而外
-而已
-而是
-而言
-而論
-聯系
-聯袂
-背地裏
-背靠背
-能
-能否
-能夠
-騰
-自
-自個兒
-自從
-自各兒
-自後
-自家
-自己
-自打
-自身
-臭
-至
-至於
-至今
-至若
-致
-般的
-良好
-若
-若夫
-若是
-若果
-若非
-範圍
-莫
-莫不
-莫不然
-莫如
-莫若
-莫非
-獲得
-藉以
-雖
-雖則
-雖然
-雖說
-蠻
-行為
-行動
-表明
-表示
-被
-要
-要不
-要不是
-要不然
-要麽
-要是
-要求
-見
-規定
-覺得
-譬喻
-譬如
-認為
-認真
-認識
-讓
-許多
-論
-論說
-設使
-設或
-設若
-誠如
-誠然
-話說
-該
-該當
-說明
-說來
-說說
-請勿
-諸
-諸位
-諸如
-誰
-誰人
-誰料
-誰知
-謹
-豁然
-賊死
-賴以
-趕
-趕快
-趕早不趕晚
-起
-起先
-起初
-起頭
-起來
-起見
-起首
-趁
-趁便
-趁勢
-趁早
-趁機
-趁熱
-趁著
-越是
-距
-跟
-路經
-轉動
-轉變
-轉貼
-轟然
-較
-較為
-較之
-較比
-邊
-達到
-達旦
-迄
-迅速
-過
-過於
-過去
-過來
-運用
-近
-近幾年來
-近年來
-近來
-還
-還是
-還有
-還要
-這
-這壹來
-這個
-這麽
-這麽些
-這麽樣
-這麽點兒
-這些
-這會兒
-這兒
-這就是說
-這時
-這樣
-這次
-這點
-這種
-這般
-這邊
-這裏
-這麼
-進入
-進去
-進來
-進步
-進而
-進行
-連
-連同
-連聲
-連日
-連日來
-連袂
-連連
-遲早
-迫於
-適應
-適當
-適用
-逐步
-逐漸
-通常
-通過
-造成
-逢
-遇到
-遭到
-遵循
-遵照
-避免
-那
-那個
-那麽
-那麽些
-那麽樣
-那些
-那會兒
-那兒
-那時
-那末
-那樣
-那般
-那邊
-那裏
-那麼
-部分
-都
-鄙人
-采取
-裏面
-重大
-重新
-重要
-鑒於
-針對
-長期以來
-長此下去
-長線
-長話短說
-問題
-間或
-防止
-阿
-附近
-陳年
-限制
-陡然
-除
-除了
-除卻
-除去
-除外
-除開
-除此
-除此之外
-除此以外
-除此而外
-除非
-隨
-隨後
-隨時
-隨著
-隨著
-隔夜
-隔日
-難得
-難怪
-難說
-難道
-難道說
-集中
-零
-需要
-非但
-非常
-非徒
-非得
-非特
-非獨
-靠
-頂多
-頃
-頃刻
-頃刻之間
-頃刻間
-順
-順著
-頓時
-頗
-風雨無阻
-飽
-首先
-馬上
-高低
-高興
-默然
-默默地
-齊
-︿
-!
-#
-$
-%
-&
-'
-(
-)
-)÷(1-
-)、
-*
-+
-+ξ
-++
-,
-,也
--
--β
---
--[*]-
-.
-/
-0
-0:2
-1
-1.
-12%
-2
-2.3%
-3
-4
-5
-5:0
-6
-7
-8
-9
-:
-;
-<
-<±
-<Δ
-<λ
-<φ
-<<
-=
-=″
-=☆
-=(
-=-
-=[
-={
->
->λ
-?
-@
-A
-LI
-R.L.
-ZXFITL
-[
-[①①]
-[①②]
-[①③]
-[①④]
-[①⑤]
-[①⑥]
-[①⑦]
-[①⑧]
-[①⑨]
-[①A]
-[①B]
-[①C]
-[①D]
-[①E]
-[①]
-[①a]
-[①c]
-[①d]
-[①e]
-[①f]
-[①g]
-[①h]
-[①i]
-[①o]
-[②
-[②①]
-[②②]
-[②③]
-[②④
-[②⑤]
-[②⑥]
-[②⑦]
-[②⑧]
-[②⑩]
-[②B]
-[②G]
-[②]
-[②a]
-[②b]
-[②c]
-[②d]
-[②e]
-[②f]
-[②g]
-[②h]
-[②i]
-[②j]
-[③①]
-[③⑩]
-[③F]
-[③]
-[③a]
-[③b]
-[③c]
-[③d]
-[③e]
-[③g]
-[③h]
-[④]
-[④a]
-[④b]
-[④c]
-[④d]
-[④e]
-[⑤]
-[⑤]]
-[⑤a]
-[⑤b]
-[⑤d]
-[⑤e]
-[⑤f]
-[⑥]
-[⑦]
-[⑧]
-[⑨]
-[⑩]
-[*]
-[-
-[]
-]
-]∧′=[
-][
-_
-a]
-b]
-c]
-e]
-f]
-ng昉
-{
-{-
-|
-}
-}>
-~
-~±
-~+
-¥
-,
-。
-·
-:
-:
-;
-;
-、
-」
-「
-"
-‵
-’
-′
-‘
-'
-"
-!
-!
-,
-[
-]
-~
-~
-+
-=
--
-`
-)
-(
-)
-(
-〉
-《
-》
-/
-/
-?
-?
-.
-【
-】
-[
-]
-…
-.......
-..
-丨
-|
-—
-≤
-※
-◆
-*
-@
-#
-$
-^
-&
-,
-\
-|
-_
-_
-=
-±
-+
-﹢
-@
-⊕
-⊙
-㊣
-﹫
-﹟
-#
-$
-€
-﹩
-¢
-£
-¥
-%
-﹪
-﹤
-︿
-<
-﹠
-&
-*
-×
-※
-╳
-﹡
-︵
-﹙
-﹚
-︶
--
-¯
-–
-—
-‥
-←
-→
-ˍ
-﹉
-_
- ̄
-≒
-≠
-≡
-≦
-≧
-﹦
-『
-』
-〔
-〕
-︹
-︺
-︻
-︼
-﹁
-﹂
-﹃
-﹄
-﹝
-﹞
-「
-」
-↖
-\
-↘
-﹨
-‘
-’
-′
-﹔
-﹑
-﹑
-·
-‧
-﹒
-.
-÷
-↗
-↙
-∕
-▶
-🔗
-👉
-
-呼籲
-肯定
-統計
-平均
-下降
-萬人
-人口
-高達
-成長
-降低
-逐年
-趨勢
-數量
-全國
-年度
-降到
-落差
-推估
-差距
-件數
-年來
-七成
-一句
-每次
-感受
-幫忙
-要說
-更好
-道理
-永遠
-我講
-想到
-說過
-不想
-記得
-厲害
-心裡
-身為
-鄉下
-做事
-可憐
-媒體
-報導
-新聞
-澄清
-新聞稿
-消息
-發布
-一則
-錯誤
-指出
-記者會
-一篇
-幾天
-評論
-文章
-一隻
-解除
-萬人次
-月底
-年底
-開會
-正式
-第一次
-明天
-第二次
-剩下
-兩次
-還沒
-都還
-答應
-定案
-過了
-信心
-上個
-幾次
-月初
-第三個
-主題
-一家
-第二點
-第一點
-底下
-意義
-道理
-要用
-一部分
-錯誤
-對外
-第三個
-第三點
-差別
-重複
-要給
-所講
-要講
-矛盾
-現階段
-台下
-離開
-對此
-這項
-可否
-不知
-一項
-提及
-安排
-做法
-所說
-在內
-有何
-則是
-只能
-並未
-一事
-所知
-指出
-感到
-何種
-一場
-訴求
-各界
-安排
-與會
-com
-https
-pic
-twlydata
-一張
-通知
-電話
-一天
-照片
-這張
-那天
-當天
-打電話
-一位
-晚上
-聯絡
-幾天
-是嗎
-對吧
-重視
-很快
-都還
-最快
-進一步
-上個
-本院
-擬具
-提議
-增列
-公決
-議事日程
-有當
-敬請
-有鑑於
-增訂
-一屆
-送進來
-一步
-這部
-院會
-順利
-講說
-問你
-我問
-記得
-牽涉到
-講了
-錯誤
-子嗎
-全民
-會後
-題目
-的嗎
-當成
-是嗎
-發揮
-表現
-創造
-用心
-付出
-重視
-貢獻
-帶領
-互動
-感受
-意義
-年來
-第一項
-第二項
-第四條
-第三項
-第三條
-第五條
-院版
-第二條
-第六條
-一項
-第一條
-第七條
-第九條
-第八條
-第十五條
-第一款
-第十四條
-第八
-第十二條
-年度多少錢
-編了
-億多元
-這筆
-多萬元
-年度
-主動
-要花
-一筆
-多錢
-剩下
-一千多
-分配
-用到
-公投
-沒錯
-一塊
-正式
-進度
-ok
-宣導
-推廣
-事後
-事前
-認知
-事先
-預防
-效果
-教育
-行銷
-知識
-大眾
-防範
-做出
-政令
-還滿
-將來
-排除
-效果
-慎重
-還會
-同一個
-講過
-拿來
-這會
-當作
-說服
-回頭
-在外
-性質
-採用
-正面
-不太
-效應
-民間
-最起碼
-行政官員
-樣子
-解決問題
-舉手
-全部都是
-ok
-誤導
-白紙黑字
-當你
-請舉手
-講完
-首長
-在場
-備詢
-先進
-記者
-女士
-夥伴
-上臺
-不在
-簡報
-當年
-往下
-幾位
-一頁
-上台
-煩請
-回座
-我先
-滿多
-實說
-真實
-工具
-情境
-直白
-未必
-到位
-討論一下
-那種
-不太
-幾位
-層次
-還會
-有個
-還滿
-來談
-顧慮
-地講
-對不起
-失望
-坦白講
-個例
-我講
-牽涉到
-我會
-我剛
-內部
-比方說
-差別
-稍微
-我舉
-一段
-剛才講
-好奇
-說真的
-一段時間
-加速
-更好
-三年
-五年
-期限
-半年
-十年
-四年
-上限
-設定
-過了
-只能
-縮短
-每次
-年內
-主動
-管道
-聯繫
-被動
-意願
-接觸
-做過
-提出申請
-扮演
-地去
-會來
-還會
-引發
-很難
-陸陸續續
-研擬
-還不
-再問
-這樣的話
-起碼
-問的
-抱歉
-對啊
-對嗎
-了吧
-樣子
-問了
-無關
-的啊
-一大堆
-講過
-在問
-照理
-是誰
-講法
-一下子
-錯吧
-答案
-安心
-所說
-讓民眾
-給你
-給他
-太大
-功能
-強化
-運作
-品質
-能量
-面向
-建構
-完善
-缺乏
-藉由
-扮演
-價值
-地去
-設立
-凸顯
-很難
-是嗎
-以往
-提問
-對外
-揭露
-甄選
-科目
-這位
-追究
-紀錄
-一而再
-再而三
-一份
-給我
-狀態
-這份
-會後
-回覆
-看過
-ok
-我想問
-書面資料
-再給
-我會
-答案
-問過
-手上
-報告書
-滿意
-想問
-題目
-寫到
-坦白說
-說實話
-承認
-更好
-想像
-這才
-直說
-坦白講
-這裡面
-部裡面
-不見得
-乾脆
-精準
-講了
-搭配
-三位
-尊重
-講清楚
-我講
-講話
-答案
-講了
-問你
-我問
-講得
-隨便
-了嘛
-給你
-一句
-道理
-要講
-了啦
-了啊
-就問
-在講
-對吧
-長期
-疑慮
-定期
-檢視
-短期
-空間
-審慎
-擔憂
-要來
-狀態
-確保
-不論是
-認同
-嚴謹
-層面
-涵蓋
-穩定
-兼顧
-何來
-兩位
-熟悉
-推薦
-組長
-送給
-拜訪
-合適
-下次
-帶頭
-聽過
-願不願意
-很小
-來回
-聽說
-多年
-牽扯
-示範
-轉達
-主政
-細部
-七千
-聽說
-陸續
-最多
-人到
-這麼久
-會給
-分到
-大膽
-我還
-說好
-第十條
-會同
-條款
-第十一條
-法裡面
-寫法
-第五款
-指定
-第十八條
-第六款
-之二
-權利
-限縮
-時程
-完畢
-延後
-上線
-太久
-上半年
-時間表
-今年年底
-拖延
-下個
-這麼久
-預定
-下半年
-遲遲
-延遲
-一再
-去年底
-取代
-高於
-遺憾
-攸關
-凝聚
-非常感謝
-多年
-及第
-照列
-十分之一
-自行
-好啦
-全數
-多一點
-可惜
-留下
-犧牲
-長久以來
-時刻
-這對
-來到
-批評
-留在
-發聲
-一再
-溫暖
-做得好
-這都
-打擊
-加快腳步
-一本
-可惜
-這兩項
-兩項
-點名
-五項
-中有
-在意
-先問
-這不
-兩週
-二分之一
-三分之二
-少於
-第三十三條
-四個
-第二件
-六個月
-第一件
-兩件
-誇張
-對啦
-的嘛
-國是
-好事
-這跟
-私底下
-這就
-原則上
-這要
-解釋一下
-是講
-兩邊
-考慮一下
-連續
-兩天
-實在話
-禮拜一
-禮拜五
-上午
-三天
-標題
-禮拜六
-星期
-禮拜四
-上個月
-十二月
-一般性
-禮拜天
-禮拜三
-這一
-傳出
-忘記
-人會
-我想
-(
-)
-c
diff --git a/.Rproj.user/763C8F27/sources/session-ab45fd2f/EEE38DEE-contents b/.Rproj.user/763C8F27/sources/session-ab45fd2f/EEE38DEE-contents
deleted file mode 100644
index 69a50486..00000000
--- a/.Rproj.user/763C8F27/sources/session-ab45fd2f/EEE38DEE-contents
+++ /dev/null
@@ -1,160 +0,0 @@
-#' The Legislator' Demographic Information and Background 提供委員基本資料
-#'
-#'@author David Liao (davidycliao@@gmail.com)
-#'
-#'@param term numeric or NULL The data is available from the 2nd term.
-#'
-#'@param verbose logical, indicates whether get_meetings should print out
-#'detailed output when retrieving the data. The default is set to TRUE.
-#'
-#'@return list contains: \describe{
-#' \item{`query_time`}{the queried time}
-#' \item{`queried_term`}{the queried term}
-#' \item{`url`}{the retrieved json url}
-#' \item{`variable_names`}{the variables of the tibble dataframe}
-#' \item{`manual_info`}{the official manual from \url{https://data.ly.gov.tw/getds.action?id=16}, or use legisTaiwan::get_variable_info("get_legislators")}
-#' \item{`data`}{a tibble dataframe, whose variables include:
-#' \describe{\item{`term`}{屆別}
-#' \item{`name`}{委員姓名}
-#' \item{`ename`}{委員姓名}
-#' \item{`sex`}{性別}
-#' \item{`party`}{黨籍}
-#' \item{`partyGroup`}{黨團}
-#' \item{`committee`}{委員會}
-#' \item{`onboardDate`}{到職日(西元年)}
-#' \item{`degree`}{學歷}
-#' \item{`experience`}{經歷}
-#' \item{`picPath`}{照片位址}
-#' \item{`leaveFlag`}{離職日期(西元年)}
-#' \item{`leaveReason`}{離職原因}
-#' }
-#' }
-#' }
-#'
-#'@importFrom attempt stop_if_all
-#'@importFrom jsonlite fromJSON
-#'@importFrom withr with_options
-#'
-#'@export
-#'
-#'@examples
-#' ## query the Executives' answered response by term and the session period.
-#' ## 輸入「立委屆期」與「會期」下載「行政院答復」
-#'get_executive_response(term = 8, session_period = 1)
-#'
-#'@details `get_legislators` produces a list, which contains `query_time`,
-#'`queried_term`, `url`, `variable_names`, `manual_info` and `data`.
-#'
-#'@note To retrieve the user manual and more information about variable of the data
-#' frame, please use `get_variable_info("get_legislators")`
-#' or visit the API manual at \url{https://data.ly.gov.tw/getds.action?id=16}.
-#' 提供委員基本資料,最早資料可追溯至第2屆。
-#'
-#'@seealso
-#'`get_variable_info("get_legislators")`, `review_session_info()`
-
-get_legislators <- function(term = NULL, verbose = TRUE) {
- check_internet()
-
- # 先檢查 term 並顯示訊息
- if (is.null(term)) {
- message("\nTerm is not defined...\nRequesting full data from the API. Please ensure stable connectivity.\n")
- }
-
- # 初始化進度顯示
- if(isTRUE(verbose)) {
- cat("\nInput Format Information:\n")
- cat("------------------------\n")
- cat("Term: Must be numeric (e.g., 8, 9, 10)\n")
- cat("------------------------\n\n")
- cat("Downloading legislators data...\n")
- pb <- txtProgressBar(min = 0, max = 100, style = 3)
- }
-
- # Update progress bar to 20%
- if(isTRUE(verbose)) setTxtProgressBar(pb, 20)
-
- # 建構 API URL
- if (is.null(term)) {
- set_api_url <- paste("https://data.ly.gov.tw/odw/ID16Action.action?name=&sex=&party=&partyGroup=&areaName=&term=",
- term, "=&fileType=json", sep = "")
- } else {
- attempt::stop_if_all(term, is.character, msg = "Please use numeric format only.")
- if (length(term) == 1) {
- term <- sprintf("%02d", as.numeric(term))
- } else if (length(term) > 1) {
- if(isTRUE(verbose)) close(pb)
- term <- paste(sprintf("%02d", as.numeric(term)), collapse = "&")
- message("API does not support multiple terms. Data might be incomplete.")
- }
-
- # Update progress bar to 40%
- if(isTRUE(verbose)) setTxtProgressBar(pb, 40)
- set_api_url <- paste("https://data.ly.gov.tw/odw/ID16Action.action?name=&sex=&party=&partyGroup=&areaName=&term=",
- term, "=&fileType=json", sep = "")
- }
-
- # 取得資料
- tryCatch(
- {
- # Update progress bar to 60%
- if(isTRUE(verbose)) setTxtProgressBar(pb, 60)
-
- with_options(list(timeout = max(1000, getOption("timeout"))),{
- json_df <- jsonlite::fromJSON(set_api_url)
- })
-
- # Update progress bar to 80%
- if(isTRUE(verbose)) setTxtProgressBar(pb, 80)
-
- df <- tibble::as_tibble(json_df$dataList)
- attempt::stop_if_all(nrow(df) == 0, isTRUE, msg = "Query returned no data.")
-
- # 計算統計資訊
- term <- paste(sort(as.numeric(unique(df$term))), collapse = " ", sep = ",")
- party_counts <- table(df$party)
-
- # Update progress bar to 100% and show results
- if(isTRUE(verbose)) {
- setTxtProgressBar(pb, 100)
- close(pb)
- cat("\n\n")
- cat("====== Retrieved Information ======\n")
- cat("-----------------------------------\n")
- cat(" URL: ", set_api_url, "\n")
- cat(" Term: ", term, "\n")
- cat(" Total Legislators: ", nrow(df), "\n")
- cat("-----------------------------------\n")
- cat("Party Distribution:\n")
- for(party in names(party_counts)) {
- if(!is.na(party) && party != "") {
- cat(sprintf(" %s: %d\n", party, party_counts[party]))
- }
- }
- cat("===================================\n")
- }
-
- # 回傳結果
- list_data <- list(
- "title" = "Legislator's Demographic Information",
- "query_time" = Sys.time(),
- "queried_term" = term,
- "url" = set_api_url,
- "total_legislators" = nrow(df),
- "party_distribution" = party_counts,
- "variable_names" = colnames(df),
- "manual_info" = "https://data.ly.gov.tw/getds.action?id=16",
- "data" = df
- )
- return(list_data)
- },
- error = function(error_message) {
- if(isTRUE(verbose)) {
- close(pb)
- cat("\nError occurred while fetching data:\n")
- cat(sprintf("Error: %s\n", error_message))
- }
- message(error_message)
- }
- )
-}
diff --git a/.Rproj.user/763C8F27/sources/session-ab45fd2f/F57577DE-contents b/.Rproj.user/763C8F27/sources/session-ab45fd2f/F57577DE-contents
deleted file mode 100644
index dd84ea78..00000000
--- a/.Rproj.user/763C8F27/sources/session-ab45fd2f/F57577DE-contents
+++ /dev/null
@@ -1,38 +0,0 @@
----
-name: Bug report
-about: Create a report to help us improve
-title: ''
-labels: ''
-assignees: ''
-
----
-
-**Describe the bug**
-A clear and concise description of what the bug is.
-
-**To Reproduce**
-Steps to reproduce the behavior:
-1. Go to '...'
-2. Click on '....'
-3. Scroll down to '....'
-4. See error
-
-**Expected behavior**
-A clear and concise description of what you expected to happen.
-
-**Screenshots**
-If applicable, add screenshots to help explain your problem.
-
-**Desktop (please complete the following information):**
- - OS: [e.g. iOS]
- - Browser [e.g. chrome, safari]
- - Version [e.g. 22]
-
-**Smartphone (please complete the following information):**
- - Device: [e.g. iPhone6]
- - OS: [e.g. iOS8.1]
- - Browser [e.g. stock browser, safari]
- - Version [e.g. 22]
-
-**Additional context**
-Add any other context about the problem here.
diff --git a/.Rproj.user/763C8F27/sources/session-ab45fd2f/FA99B130-contents b/.Rproj.user/763C8F27/sources/session-ab45fd2f/FA99B130-contents
deleted file mode 100644
index bbcbbe7d..00000000
--- a/.Rproj.user/763C8F27/sources/session-ab45fd2f/FA99B130-contents
+++ /dev/null
@@ -1,20 +0,0 @@
----
-name: Feature request
-about: Suggest an idea for this project
-title: ''
-labels: ''
-assignees: ''
-
----
-
-**Is your feature request related to a problem? Please describe.**
-A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
-
-**Describe the solution you'd like**
-A clear and concise description of what you want to happen.
-
-**Describe alternatives you've considered**
-A clear and concise description of any alternative solutions or features you've considered.
-
-**Additional context**
-Add any other context or screenshots about the feature request here.
diff --git a/.Rproj.user/763C8F27/sources/session-ab45fd2f/FFAE5E60-contents b/.Rproj.user/763C8F27/sources/session-ab45fd2f/FFAE5E60-contents
deleted file mode 100644
index 5a776df2..00000000
--- a/.Rproj.user/763C8F27/sources/session-ab45fd2f/FFAE5E60-contents
+++ /dev/null
@@ -1,47 +0,0 @@
-test_that("get_meetings", {
- expect_equal(get_meetings(start_date = 1050120, end_date = 1050210, verbose = FALSE)$data$smeeting_date, "105/02/01")
- expect_equal(nrow(get_meetings(start_date = 1040120, end_date = 1050310, verbose = TRUE)$data), 807)
- expect_error(get_meetings(start_date = 1040101, end_date = 1040102, verbose = FALSE), "The query is unavailable.")
-
-})
-
-test_that("get_caucus_meetings", {
- expect_equal(get_caucus_meetings(start_date = "106/10/20", end_date = "107/03/10", verbose = FALSE)$retrieved_number, 27)
- expect_equal(get_caucus_meetings(start_date = "106/10/20", end_date = "107/03/10", verbose = FALSE)$retrieved_number,27)
-})
-
-# test_that("get_speech_video", {
-# expect_equal(get_speech_video(start_date = "105/10/20", end_date = "109/03/10")$retrieved_number, 547)
-# expect_equal(get_speech_video(start_date = "105/10/20", end_date = "109/03/10", verbose = FALSE)$retrieved_number, 547)
-# expect_error(get_speech_video(start_date = "104/01/01", end_date = "104/01/02", verbose = FALSE), "The query is unavailable.")
-#
-# })
-
-test_that("get_public_debates", {
- expect_equal(get_public_debates(term = 10, session_period = 1)$retrieved_number, 107)
- # expect_equal(get_public_debates(term = 10, session_period = 1, verbose = FALSE)$retrieved_number, 107)
- expect_error(get_public_debates(term = "10"), "use numeric format only.")
- # expect_error(get_public_debates(term = "10", verbose = TRUE), "use numeric format only.")
- # expect_equal(get_public_debates(term = NULL, verbose = TRUE)$title, "the records of the questions answered by the executives")
- # expect_message(get_public_debates(c(10,11)),
- # "The API is unable to query multiple terms and the retrieved data might not be complete.")
- # expect_error(get_public_debates(term = 30), "The query is unavailable.")
-
- })
-
-
-# test_that("get_committee_record", {
-# expect_equal(get_committee_record(term = 8, session_period= 1, verbose = FALSE)$retrieved_number, 613)
-# expect_equal(get_committee_record(term = 8, session_period= 2, verbose = FALSE)$retrieved_number, 633)
-# expect_equal(get_committee_record(term = 8, session_period= 2, verbose = TRUE)$title, "the records of reviewed items in the committees")
-# expect_error(get_committee_record(term = 2), "The query is unavailable.")
-# # expect_message(get_committee_record(c(10,11)),
-# # "The API is unable to query multiple terms and the retrieved data might not be complete.")
-# })
-
-# test_that("get_committee_record", {
-# expect_equal(get_committee_record(term = 10, session_period= 1, verbose = FALSE)$retrieved_number, 4844)
-# expect_equal(get_committee_record(term = 10, session_period= 2, verbose = TRUE)$title, "the records of reviewed items in the committees")
-# expect_error(get_committee_record(term = 2), "The query is unavailable.")
-# })
-
diff --git a/.Rproj.user/763C8F27/sources/session-ab45fd2f/lock_file b/.Rproj.user/763C8F27/sources/session-ab45fd2f/lock_file
deleted file mode 100644
index e69de29b..00000000
diff --git a/.Rproj.user/763C8F27/sources/session-fadbc9d6/D47C35DD b/.Rproj.user/763C8F27/sources/session-fadbc9d6/D47C35DD
index 22dc9fac..57c8b42e 100644
--- a/.Rproj.user/763C8F27/sources/session-fadbc9d6/D47C35DD
+++ b/.Rproj.user/763C8F27/sources/session-fadbc9d6/D47C35DD
@@ -3,7 +3,7 @@
"path": "~/Dropbox/My Packages/legisTaiwan/README.Rmd",
"project_path": "README.Rmd",
"type": "r_markdown",
- "hash": "1733884509",
+ "hash": "0",
"contents": "",
"dirty": false,
"created": 1698771600546.0,
@@ -12,8 +12,8 @@
"properties": {
"source_window_id": "",
"Source": "Source",
- "cursorPosition": "81,4",
- "scrollLine": "70",
+ "cursorPosition": "90,20",
+ "scrollLine": "61",
"rmdVisualMode": "false",
"rmdVisualCollapsedChunks": "",
"rmdVisualModeLocation": "2:0"
diff --git a/.Rproj.user/shared/notebooks/paths b/.Rproj.user/shared/notebooks/paths
index 83891fe6..1f50bc1a 100644
--- a/.Rproj.user/shared/notebooks/paths
+++ b/.Rproj.user/shared/notebooks/paths
@@ -17,8 +17,6 @@
/Users/yenchiehliao/Dropbox/My Packages/legisTaiwan/README.Rmd="9551FBD9"
/Users/yenchiehliao/Dropbox/My Packages/legisTaiwan/README.md="8286F09A"
/Users/yenchiehliao/Dropbox/My Packages/legisTaiwan/_pkgdown.yml="70150FBB"
-/Users/yenchiehliao/Dropbox/My Packages/legisTaiwan/data/stopwords.txt="A690602C"
-/Users/yenchiehliao/Dropbox/My Packages/legisTaiwan/data/user_dict.txt="13C35A6D"
/Users/yenchiehliao/Dropbox/My Packages/legisTaiwan/inst/CONDUCT.md="89F7252D"
/Users/yenchiehliao/Dropbox/My Packages/legisTaiwan/inst/README.Rmd="9CD5F4AC"
/Users/yenchiehliao/Dropbox/My Packages/legisTaiwan/man/get_caucus_meetings.Rd="AA69F12D"
@@ -31,5 +29,4 @@
/Users/yenchiehliao/Dropbox/My Packages/legisTaiwan/vignettes/get_caucus_meetings.rmd="76665D7C"
/Users/yenchiehliao/Dropbox/My Packages/legisTaiwan/vignettes/get_legislators.Rmd="0C109076"
/Users/yenchiehliao/Dropbox/My Packages/legisTaiwan/vignettes/get_parlquestions.Rmd="D28F044A"
-/Users/yenchiehliao/Dropbox/My Packages/legisTaiwan/vignettes/manual.R="2842ED1E"
/Users/yenchiehliao/Dropbox/My Packages/legisTaiwan/vignettes/quickstart.Rmd="5E338CCA"
diff --git a/.gitignore b/.gitignore
index 4c35a620..9285d0cb 100644
--- a/.gitignore
+++ b/.gitignore
@@ -7,3 +7,4 @@
^\.github$
^codecov\.yml$
^.*\.utf8\.R$
+.Rproj.user