The hardware and bandwidth for this mirror is donated by dogado GmbH, the Webhosting and Full Service-Cloud Provider. Check out our Wordpress Tutorial.
If you wish to report a bug, or if you are interested in having us mirror your free-software or open-source project, please feel free to contact us at mirror[@]dogado.de.

Documentation: https://lwarode.github.io/partycoloR/
partycoloR extracts political party colors and logos from English Wikipedia party pages. Party colors play a crucial role in visually identifying political parties in data visualizations and research.
You can install partycoloR from GitHub:
# install.packages("devtools")
devtools::install_github("lwarode/partycoloR")library(partycoloR)
# Single party
get_party_color("https://en.wikipedia.org/wiki/Democratic_Party_(United_States)")
#> "#0015BC"
# Multiple parties
urls <- c(
"https://en.wikipedia.org/wiki/Democratic_Party_(United_States)",
"https://en.wikipedia.org/wiki/Republican_Party_(United_States)"
)
get_party_color(urls)
#> "#0015BC" "#E81B23"get_party_logo("https://en.wikipedia.org/wiki/Democratic_Party_(United_States)")
#> "https://upload.wikimedia.org/wikipedia/commons/thumb/..."
# Download a logo to file
get_party_logo_by_name("SPD", country = "DEU") %>%
download_party_logo("spd_logo.svg")get_party_info(urls)
#> # A tibble: 2 x 3
#> url color logo_url
#> <chr> <chr> <chr>
#> 1 https://en.wikipedia.org/wiki/Democratic_Party_(Unite... #0015BC https://...
#> 2 https://en.wikipedia.org/wiki/Republican_Party_(Unite... #E81B23 https://...library(dplyr)
parties <- tibble(
party = c("Democrats", "Republicans"),
wiki_url = urls
)
parties %>%
mutate(color = get_party_color(wiki_url))
#> # A tibble: 2 x 3
#> party wiki_url color
#> <chr> <chr> <chr>
#> 1 Democrats https://en.wikipedia.org/wiki/Democratic_Party_(Un... #0015BC
#> 2 Republicans https://en.wikipedia.org/wiki/Republican_Party_(Un... #E81B23Don’t have Wikipedia URLs? Use the Partyfacts integration:
# Download Partyfacts data
pf_data <- get_partyfacts_wikipedia()
# Look up a party
lookup_party_url("SPD", country = "DEU")
# Or get the color directly
get_party_color_by_name("SPD", country = "DEU")
#> "#E3000F"The package scrapes the Wikipedia infobox (vcard table) for party pages, extracting:
<span> elements
with background-color style attributes
partycoloR
If you use this package in your research, please cite it:
citation("partycoloR")GPL-3
These binaries (installable software) and packages are in development.
They may not be fully stable and should be used with caution. We make no claims about them.
Health stats visible at Monitor.