partycolor: Get colors of parties

Description Usage Arguments Examples

View source: R/partycolor.R

Description

Returns the colors of parties

Usage

1
2
3
4
5
6
7
8
9
partycolor(
  ids,
  type = c("hex", "rgb", "cmyk", "all"),
  websafe = FALSE,
  include_ids = FALSE,
  include_description = FALSE,
  include_source = FALSE,
  include_multiple = FALSE
)

Arguments

ids

A single id or vector of ids from the Party Facts data set.

type

The color model the colors should be in, can be hex, rgb, cmyk, or all (if all three types should be returned). Default is hex.

websafe

logical: should web safe colors be returned instead? Old browsers were not able to display other colors than these, with current browsers this option should not be necessary, default is FALSE.

include_ids

logical: should party facts ids be included in the output? If the colors get added to an existing data frame that already has the ids this is usually not helpful, default is FALSE.

include_description

logical: should the name of the color (e.g. "Dark blue") be included in the output? Default is FALSE.

include_source

logical: should the data source of the color be included in the output? Can be wikidata or wikipedia, default is FALSE.

include_multiple

logical: in some cases parties have multiple party colors, in these cases only one of them is included in this data set. Should information on whether the party has multiple colors according to the source, default is FALSE.

Examples

1
2
3
4
5
6
7
8
austrianparties <- data.frame(names=c("OEVP","SPOE","FPOE","Gruene","Neos"), partyfacts_id=c(1329,1384,463,1659,1970))
## this returns a simple vector of all hex triplets
austrianparties$color <- partycolor(austrianparties$partyfacts_id)
## this returns a data frame consisting of colors in all three color models, party facts ids, 
color descriptions and color source.
austriancolors <- partycolor(austrianparties$partyfacts_id, 
type='all', include_ids = TRUE, 
include_description = TRUE, include_source = TRUE)

imrem/partycoloR documentation built on Dec. 20, 2021, 6:59 p.m.