Learn R Programming

partycoloR (version 0.2.0)

get_party_info_by_name: Get party info by name

Description

A convenience function that combines party lookup with color and logo extraction. Searches for a party by name, finds its Wikipedia URL, and extracts both color and logo.

Usage

get_party_info_by_name(
  party_name,
  country = NULL,
  all_colors = FALSE,
  data = NULL
)

Value

A tibble with party info, color, and logo_url columns. Returns a tibble with zero rows if no party is found.

Arguments

party_name

A character string with the party name to search for.

country

Optional. ISO 3-letter country code to filter results.

all_colors

Logical. If `TRUE`, includes all colors as a list-column. Default is `FALSE`.

data

Optional. A Partyfacts dataset.

Examples

Run this code
# \donttest{
if (curl::has_internet()) {
  # Get info for German SPD
  get_party_info_by_name("SPD", country = "DEU")

  # Search more broadly with all colors
  get_party_info_by_name("Labour", country = "GBR", all_colors = TRUE)
}
# }

Run the code above in your browser using DataLab