View source: R/get_ly_legislators_by_term.R
get_ly_legislators_by_term | R Documentation |
Retrieves a paginated list of legislators for a specific Legislative Yuan term. The function provides detailed information about legislators including their names, parties, and represented areas. It also includes metadata about the total number of legislators and pagination information.
get_ly_legislators_by_term(term, page = 1, limit = 20, show_progress = TRUE)
term |
required integer. Legislative term number (e.g., 9) |
page |
integer. Page number for pagination (default: 1) |
limit |
integer. Number of records per page (default: 20) |
show_progress |
logical. Whether to display progress bar and summary statistics (default: TRUE) |
Get Legislative Yuan Legislators by Term
The function includes a progress bar and detailed summary statistics when show_progress is TRUE. The summary includes:
Total number of legislators
Current page and total pages
Records per page
Party and area distribution (if available)
A list with two components:
A list containing:
Total number of legislators
Total number of pages
Current page number
Number of records per page
A data frame containing legislator information:
Legislative term
Legislator's name
Political party affiliation
Represented area (if available)
Additional columns as provided by the API
get_ly_legislator_detail
for getting detailed information about a specific legislator
## Not run:
# Get first page of legislators for term 9
result <- get_ly_legislators_by_term(term = 9)
# Get second page with 30 records per page
result <- get_ly_legislators_by_term(
term = 9,
page = 2,
limit = 30
)
# Access the results
metadata <- result$metadata
legislators_df <- result$legislators
# Display total number of legislators
cat("Total legislators:", metadata$total, "\n")
# Show first few rows of legislator data
head(legislators_df)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.