Learn R Programming

partycoloR (version 0.2.0)

get_party_logo_by_name: Get party logo by name

Description

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

Usage

get_party_logo_by_name(party_name, country = NULL, data = NULL)

Value

If exactly one party is found, returns the logo URL. If multiple parties match, returns a tibble with party info and logo URLs. Returns NA 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.

data

Optional. A Partyfacts dataset.

Examples

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

  # Search more broadly
  get_party_logo_by_name("Labour", country = "GBR")
}
# }

Run the code above in your browser using DataLab