Title: Local Political Actor Network Diachronic Analysis Tools
Version: 0.2.0
Description: Provides functions to prepare, visualize, and analyse diachronic network data on local political actors, with a particular focus on the development of local party systems and identification of actor groups. Formalizes and automates a continuity diagram method that has been previously applied in research on Czech local politics, e.g. Bubenicek and Kubalek (2010, ISSN:1803-8220), Kubalek and Bubenicek (2012, ISSN:1803-8220), and Cmejrek, Bubenicek, and Copik (2010, ISBN:978-80-247-3061-5). The package also includes several example datasets derived from Czech municipal elections, compiled from official election results, field research, and previously published case studies on Czech local politics.
License: MIT + file LICENSE
Encoding: UTF-8
RoxygenNote: 7.3.3
Imports: igraph (≥ 2.1.0), dplyr, magrittr, RColorBrewer, scales
Suggests: testthat (≥ 3.0.0), withr
Config/testthat/edition: 3
URL: https://localpolitics.github.io/lpanda/, https://CRAN.R-project.org/package=lpanda, https://github.com/localpolitics/lpanda
BugReports: https://github.com/localpolitics/lpanda/issues
Depends: R (≥ 3.5)
LazyData: true
NeedsCompilation: no
Packaged: 2025-11-29 03:13:22 UTC; vasco
Author: Vaclav Bubenicek ORCID iD [aut, cre, cph] (affiliation: Czech University of Life Sciences Prague (CZU))
Maintainer: Vaclav Bubenicek <bubenicek@pef.czu.cz>
Repository: CRAN
Date/Publication: 2025-11-29 13:30:02 UTC

lpanda: Local Political Actor Network Diachronic Analysis Tools

Description

logo

Provides functions to prepare, visualize, and analyse diachronic network data on local political actors, with a particular focus on the development of local party systems and identification of actor groups. Formalizes and automates a continuity diagram method that has been previously applied in research on Czech local politics, e.g. Bubenicek and Kubalek (2010, ISSN:1803-8220), Kubalek and Bubenicek (2012, ISSN:1803-8220), and Cmejrek, Bubenicek, and Copik (2010, ISBN:978-80-247-3061-5). The package also includes several example datasets derived from Czech municipal elections, compiled from official election results, field research, and previously published case studies on Czech local politics.

Main functions

The main user-facing functions of lpanda are:

Together, these functions facilitate diachronic analysis of local political actor networks and the evolution of local party systems, particularly in small municipalities.

Basic workflow

The typical workflow in lpanda centres on continuity diagrams that trace candidacies of local political actors across multiple elections.

To create a continuity diagram of candidacies of local political actors, it is necessary to prepare election data containing at least unique names of candidates, unique names of their candidate lists and the years of the elections. In case of same names, they need to be distinguished, e.g., by adding numbers after the names of candidates (for example "Doe Jane (2)" or "Smith John, Jr.") or candidate lists (for example "Independents 3").

For a basic continuity diagram, you can directly pass the data into the plot_continuity() function. However, for deeper analysis, it is recommended to first process the basic election data using prepare_network_data(), which creates a list of network objects, and only then experiment with the various parameters offered by plot_continuity().

Municipality datasets

The lpanda package contains several datasets of municipal election results that have been the objects of case studies in various publications focused on Czech local politics. The datasets are compiled from publicly available data, and in some cases supplemented by findings from field research. They can be used to reproduce continuity diagrams published in studies referenced in the documentation of the datasets, for their deeper analysis, or simply to experiment with the workflow.

List of municipality datasets:

Author(s)

Maintainer: Vaclav Bubenicek bubenicek@pef.czu.cz (ORCID) (Czech University of Life Sciences Prague (CZU)) [copyright holder]

References

The continuity diagram approach implemented in lpanda builds on earlier attempts to visualise candidate movements ("defections") between political parties across elections. Over time, these visualisations evolved into a more general method for analysing the continuity of local political actors' candidacies. The method has been progressively formalised and systematised so that it can be reused across different case studies.

For an overview of the development of this approach and its applications in Czech local politics research, see the selected studies below, as well as the publications listed in the documentation of the individual datasets.

Bubenicek, V. (2010). Lokalni modely demokracie v malych obcich CR (Local Models of Democracy in Small Municipalities). Dissertation thesis. Czech University of Life Sciences Prague. [Full text]

Bubenicek, V., & Kubalek, M. (2010). Konfliktni linie v malych obcich (Cleavages in Small Municipalities). Acta Politologica, 2(3), 30-45. [Full text]

Cmejrek, J., Bubenicek, V., & Copik, J. (2010). Demokracie v lokalnim politickem prostoru (Democracy in Local Political Area). Prague: Grada. [Publisher link]

Kubalek, M., & Bubenicek, V. (2012). Charakter lokalni politiky v suburbannim politickem prostoru (The Nature of Local Politics in Suburban Political Space). Acta Politologica, 4(3), 284-305. [Full text]

Kotaskova, S. K. (2016). Cleavages and political pluralism in the small municipality in Czech Republic. Global Journal of Business, Economics and Management: Current Issues, 5(2), 63-69.

Hornek, J. (2022). Zhroucene obce v Ceske republice (Failed Municipalities in the Czech Republic). Dissertation thesis. Charles University. [Full text]

Krpalkova, S. (2024). Permanentni opakovani komunalnich voleb: zablokovane obce? (Permanent Repetition of Municipal Election: Blocked Municipalities?). Dissertation thesis. Charles University. [Full text]

See Also

Useful links:


Municipal Election Data: Bublava (SO, CZ)

Description

A dataset containing individual-level candidacy records from municipal elections in the municipality of Bublava (district Sokolov, Czech Republic).

Usage

Bublava_SO_cz

Format

An object of class data.frame with 193 rows and 14 columns.

Details

Dataset overview:
Municipality: Bublava
District: Sokolov
Country: Czech Republic
Number of elections: 8
Elections covered: 1994, 1998, 2002, 2006, 2010, 2014, 2018, 2022
Number of candidacies (rows): 193
Note: Municipality website

Description of variables

Variable Description
elections Election identifiers (numeric)
candidate Candidate's full name (character)
list_name Name of the candidate list (character)
list_pos Candidate's position on the list (numeric)
pref_votes Number of preferential votes (numeric)
elected Logical; TRUE if candidate was elected
nom_party Nominating party (character)
pol_affil Political affiliation (character)
mayor TRUE if elected mayor
dep_mayor TRUE if elected deputy mayor
board TRUE if member of the executive board
gov_support TRUE if supported the local government
elig_voters Number of eligible voters (numeric)
ballots_cast Number of ballots cast (numeric)

Each record describes one candidate's run for office, including their candidate list affiliation, position on the list, nominating party, political affiliation, number of preferential votes, and whether they were elected or held specific positions (mayor, deputy mayor, member of the executive body).

The dataset also includes contextual election-level information, such as the number of eligible voters and ballots cast, which can be used to calculate voter turnout and related indicators. These variables appear only once per election and constituency (they may be stored in a single candidate row for that election/constituency)

Source

The dataset was compiled primarily from official election results published by the Czech Statistical Office. Additional contextual or verification information (such as post-election roles) was obtained from publicly available municipal records.

References

Examples

# Basic inspection
str(Bublava_SO_cz)

# Example of a basic continuity diagram (unformatted version)
plot_continuity(Bublava_SO_cz, elections = "2006-")

Municipal Election Data: Cernosice (PZ, CZ)

Description

A dataset containing individual-level candidacy records from municipal elections in the municipality of Cernosice (district Praha-zapad, Czech Republic).

Usage

Cernosice_PZ_cz

Format

An object of class data.frame with 971 rows and 14 columns.

Details

Dataset overview:
Municipality: Cernosice
District: Praha-zapad
Country: Czech Republic
Number of elections: 8
Elections covered: 1994, 1998, 2002, 2006, 2010, 2014, 2018, 2022
Number of candidacies (rows): 971
Note: Municipality website

Description of variables

Variable Description
elections Election identifiers (numeric)
candidate Candidate's full name (character)
list_name Name of the candidate list (character)
list_pos Candidate's position on the list (numeric)
pref_votes Number of preferential votes (numeric)
elected Logical; TRUE if candidate was elected
nom_party Nominating party (character)
pol_affil Political affiliation (character)
mayor TRUE if elected mayor
dep_mayor TRUE if elected deputy mayor
board TRUE if member of the executive board
gov_support TRUE if supported the local government
elig_voters Number of eligible voters (numeric)
ballots_cast Number of ballots cast (numeric)

Each record describes one candidate's run for office, including their candidate list affiliation, position on the list, nominating party, political affiliation, number of preferential votes, and whether they were elected or held specific positions (mayor, deputy mayor, member of the executive body).

The dataset also includes contextual election-level information, such as the number of eligible voters and ballots cast, which can be used to calculate voter turnout and related indicators. These variables appear only once per election and constituency (they may be stored in a single candidate row for that election/constituency)

Source

The dataset was compiled primarily from official election results published by the Czech Statistical Office. Additional contextual or verification information (such as post-election roles) was obtained from publicly available municipal records.

References

Examples

# Basic inspection
str(Cernosice_PZ_cz)

# Example of a basic continuity diagram (unformatted version)
plot_continuity(Cernosice_PZ_cz, elections = "2010-")

Municipal Election Data: Dasnice (SO, CZ)

Description

A dataset containing individual-level candidacy records from municipal elections in the municipality of Dasnice (district Sokolov, Czech Republic).

Usage

Dasnice_SO_cz

Format

An object of class data.frame with 81 rows and 14 columns.

Details

Dataset overview:
Municipality: Dasnice
District: Sokolov
Country: Czech Republic
Number of elections: 10
Elections covered: 1994, 1998, 2002, 2006, 2010, 2014, 2015.09, 2016.04, 2018, 2022
Number of candidacies (rows): 81
Note: Municipality website

Description of variables

Variable Description
elections Election identifiers (numeric)
candidate Candidate's full name (character)
list_name Name of the candidate list (character)
list_pos Candidate's position on the list (numeric)
pref_votes Number of preferential votes (numeric)
elected Logical; TRUE if candidate was elected
nom_party Nominating party (character)
pol_affil Political affiliation (character)
mayor TRUE if elected mayor
dep_mayor TRUE if elected deputy mayor
board TRUE if member of the executive board
gov_support TRUE if supported the local government
elig_voters Number of eligible voters (numeric)
ballots_cast Number of ballots cast (numeric)

Each record describes one candidate's run for office, including their candidate list affiliation, position on the list, nominating party, political affiliation, number of preferential votes, and whether they were elected or held specific positions (mayor, deputy mayor, member of the executive body).

The dataset also includes contextual election-level information, such as the number of eligible voters and ballots cast, which can be used to calculate voter turnout and related indicators. These variables appear only once per election and constituency (they may be stored in a single candidate row for that election/constituency)

Source

The dataset was compiled primarily from official election results published by the Czech Statistical Office. Additional contextual or verification information (such as post-election roles) was obtained from publicly available municipal records.

References

Examples

# Basic inspection
str(Dasnice_SO_cz)

# Example of a basic continuity diagram (unformatted version)
plot_continuity(Dasnice_SO_cz, elections = "2010-")

Municipal Election Data: Doubice (DC, CZ)

Description

A dataset containing individual-level candidacy records from municipal elections in the municipality of Doubice (district Decin, Czech Republic).

Usage

Doubice_DC_cz

Format

An object of class data.frame with 151 rows and 14 columns.

Details

Dataset overview:
Municipality: Doubice
District: Decin
Country: Czech Republic
Number of elections: 11
Elections covered: 1993, 1994, 1998, 2002, 2006, 2007, 2010, 2014, 2015, 2018, 2022
Number of candidacies (rows): 151
Note: Municipality website

Description of variables

Variable Description
elections Election identifiers (numeric)
candidate Candidate's full name (character)
list_name Name of the candidate list (character)
list_pos Candidate's position on the list (numeric)
pref_votes Number of preferential votes (numeric)
elected Logical; TRUE if candidate was elected
nom_party Nominating party (character)
pol_affil Political affiliation (character)
mayor TRUE if elected mayor
dep_mayor TRUE if elected deputy mayor
board TRUE if member of the executive board
gov_support TRUE if supported the local government
elig_voters Number of eligible voters (numeric)
ballots_cast Number of ballots cast (numeric)

Each record describes one candidate's run for office, including their candidate list affiliation, position on the list, nominating party, political affiliation, number of preferential votes, and whether they were elected or held specific positions (mayor, deputy mayor, member of the executive body).

The dataset also includes contextual election-level information, such as the number of eligible voters and ballots cast, which can be used to calculate voter turnout and related indicators. These variables appear only once per election and constituency (they may be stored in a single candidate row for that election/constituency)

Source

The dataset was compiled primarily from official election results published by the Czech Statistical Office. Additional contextual or verification information (such as post-election roles) was obtained from publicly available municipal records and interviews with local political representatives.

References

Examples

# Basic inspection
str(Doubice_DC_cz)

# Example of a basic continuity diagram (unformatted version)
plot_continuity(Doubice_DC_cz, elections = "2010-")

Municipal Election Data: Horomerice (PZ, CZ)

Description

A dataset containing individual-level candidacy records from municipal elections in the municipality of Horomerice (district Praha-zapad, Czech Republic).

Usage

Horomerice_PZ_cz

Format

An object of class data.frame with 438 rows and 14 columns.

Details

Dataset overview:
Municipality: Horomerice
District: Praha-zapad
Country: Czech Republic
Number of elections: 8
Elections covered: 1994, 1998, 2002, 2006, 2010, 2014, 2018, 2022
Number of candidacies (rows): 438
Note: Municipality website

Description of variables

Variable Description
elections Election identifiers (numeric)
candidate Candidate's full name (character)
list_name Name of the candidate list (character)
list_pos Candidate's position on the list (numeric)
pref_votes Number of preferential votes (numeric)
elected Logical; TRUE if candidate was elected
nom_party Nominating party (character)
pol_affil Political affiliation (character)
mayor TRUE if elected mayor
dep_mayor TRUE if elected deputy mayor
board TRUE if member of the executive board
gov_support TRUE if supported the local government
elig_voters Number of eligible voters (numeric)
ballots_cast Number of ballots cast (numeric)

Each record describes one candidate's run for office, including their candidate list affiliation, position on the list, nominating party, political affiliation, number of preferential votes, and whether they were elected or held specific positions (mayor, deputy mayor, member of the executive body).

The dataset also includes contextual election-level information, such as the number of eligible voters and ballots cast, which can be used to calculate voter turnout and related indicators. These variables appear only once per election and constituency (they may be stored in a single candidate row for that election/constituency)

Source

The dataset was compiled primarily from official election results published by the Czech Statistical Office. Additional contextual or verification information (such as post-election roles) was obtained from publicly available municipal records.

References

Examples

# Basic inspection
str(Horomerice_PZ_cz)

# Example of a basic continuity diagram (unformatted version)
plot_continuity(Horomerice_PZ_cz, elections = "2010-")

Municipal Election Data: Hradce (CB, CZ)

Description

A dataset containing individual-level candidacy records from municipal elections in the municipality of Hradce (district Ceske Budejovice, Czech Republic).

Usage

Hradce_CB_cz

Format

An object of class data.frame with 103 rows and 14 columns.

Details

Dataset overview:
Municipality: Hradce
District: Ceske Budejovice
Country: Czech Republic
Number of elections: 10
Elections covered: 1994, 1998, 2002, 2006, 2010, 2014, 2016, 2017, 2018, 2022
Number of candidacies (rows): 103
Note: Municipality website

Description of variables

Variable Description
elections Election identifiers (numeric)
candidate Candidate's full name (character)
list_name Name of the candidate list (character)
list_pos Candidate's position on the list (numeric)
pref_votes Number of preferential votes (numeric)
elected Logical; TRUE if candidate was elected
nom_party Nominating party (character)
pol_affil Political affiliation (character)
mayor TRUE if elected mayor
dep_mayor TRUE if elected deputy mayor
board TRUE if member of the executive board
gov_support TRUE if supported the local government
elig_voters Number of eligible voters (numeric)
ballots_cast Number of ballots cast (numeric)

Each record describes one candidate's run for office, including their candidate list affiliation, position on the list, nominating party, political affiliation, number of preferential votes, and whether they were elected or held specific positions (mayor, deputy mayor, member of the executive body).

The dataset also includes contextual election-level information, such as the number of eligible voters and ballots cast, which can be used to calculate voter turnout and related indicators. These variables appear only once per election and constituency (they may be stored in a single candidate row for that election/constituency)

Source

The dataset was compiled primarily from official election results published by the Czech Statistical Office. Additional contextual or verification information (such as post-election roles) was obtained from publicly available municipal records.

References

Examples

# Basic inspection
str(Hradce_CB_cz)

# Example of a basic continuity diagram (unformatted version)
plot_continuity(Hradce_CB_cz, elections = "2006-")

Municipal Election Data: Jilove (DC, CZ)

Description

A dataset containing individual-level candidacy records from municipal elections in the municipality of Jilove (district Decin, Czech Republic).

Usage

Jilove_DC_cz

Format

An object of class data.frame with 745 rows and 14 columns.

Details

Dataset overview:
Municipality: Jilove
District: Decin
Country: Czech Republic
Number of elections: 8
Elections covered: 1994, 1998, 2002, 2006, 2010, 2014, 2018, 2022
Number of candidacies (rows): 745
Note: Municipality website

Description of variables

Variable Description
elections Election identifiers (numeric)
candidate Candidate's full name (character)
list_name Name of the candidate list (character)
list_pos Candidate's position on the list (numeric)
pref_votes Number of preferential votes (numeric)
elected Logical; TRUE if candidate was elected
nom_party Nominating party (character)
pol_affil Political affiliation (character)
mayor TRUE if elected mayor
dep_mayor TRUE if elected deputy mayor
board TRUE if member of the executive board
gov_support TRUE if supported the local government
elig_voters Number of eligible voters (numeric)
ballots_cast Number of ballots cast (numeric)

Each record describes one candidate's run for office, including their candidate list affiliation, position on the list, nominating party, political affiliation, number of preferential votes, and whether they were elected or held specific positions (mayor, deputy mayor, member of the executive body).

The dataset also includes contextual election-level information, such as the number of eligible voters and ballots cast, which can be used to calculate voter turnout and related indicators. These variables appear only once per election and constituency (they may be stored in a single candidate row for that election/constituency)

Source

The dataset was compiled primarily from official election results published by the Czech Statistical Office. Additional contextual or verification information (such as post-election roles) was obtained from publicly available municipal records and diploma thesis cited below.

References

Examples

# Basic inspection
str(Jilove_DC_cz)

# Example of a basic continuity diagram (unformatted version)
plot_continuity(Jilove_DC_cz, elections = "1994-2010")

Municipal Election Data: Kamenna (CB, CZ)

Description

A dataset containing individual-level candidacy records from municipal elections in the municipality of Kamenna (district Ceske Budejovice, Czech Republic).

Usage

Kamenna_CB_cz

Format

An object of class data.frame with 178 rows and 14 columns.

Details

Dataset overview:
Municipality: Kamenna
District: Ceske Budejovice
Country: Czech Republic
Number of elections: 8
Elections covered: 1998, 2002, 2006, 2010, 2011, 2014, 2018, 2022
Number of candidacies (rows): 178
Note: Municipality website

Description of variables

Variable Description
elections Election identifiers (numeric)
candidate Candidate's full name (character)
list_name Name of the candidate list (character)
list_pos Candidate's position on the list (numeric)
pref_votes Number of preferential votes (numeric)
elected Logical; TRUE if candidate was elected
nom_party Nominating party (character)
pol_affil Political affiliation (character)
mayor TRUE if elected mayor
dep_mayor TRUE if elected deputy mayor
board TRUE if member of the executive board
gov_support TRUE if supported the local government
elig_voters Number of eligible voters (numeric)
ballots_cast Number of ballots cast (numeric)

Each record describes one candidate's run for office, including their candidate list affiliation, position on the list, nominating party, political affiliation, number of preferential votes, and whether they were elected or held specific positions (mayor, deputy mayor, member of the executive body).

The dataset also includes contextual election-level information, such as the number of eligible voters and ballots cast, which can be used to calculate voter turnout and related indicators. These variables appear only once per election and constituency (they may be stored in a single candidate row for that election/constituency)

Source

The dataset was compiled primarily from official election results published by the Czech Statistical Office. Additional contextual or verification information (such as post-election roles) was obtained from publicly available municipal records and the master thesis cited below.

References

Examples

# Basic inspection
str(Kamenna_CB_cz)

# Example of a basic continuity diagram (unformatted version)
plot_continuity(Kamenna_CB_cz, elections = "2002-")

Municipal Election Data: Nebanice (CH, CZ)

Description

A dataset containing individual-level candidacy records from municipal elections in the municipality of Nebanice (district Cheb, Czech Republic).

Usage

Nebanice_CH_cz

Format

An object of class data.frame with 136 rows and 14 columns.

Details

Dataset overview:
Municipality: Nebanice
District: Cheb
Country: Czech Republic
Number of elections: 9
Elections covered: 1994, 1998, 2002, 2006, 2010, 2014, 2018, 2019, 2022
Number of candidacies (rows): 136
Note: Municipality website

Description of variables

Variable Description
elections Election identifiers (numeric)
candidate Candidate's full name (character)
list_name Name of the candidate list (character)
list_pos Candidate's position on the list (numeric)
pref_votes Number of preferential votes (numeric)
elected Logical; TRUE if candidate was elected
nom_party Nominating party (character)
pol_affil Political affiliation (character)
mayor TRUE if elected mayor
dep_mayor TRUE if elected deputy mayor
board TRUE if member of the executive board
gov_support TRUE if supported the local government
elig_voters Number of eligible voters (numeric)
ballots_cast Number of ballots cast (numeric)

Each record describes one candidate's run for office, including their candidate list affiliation, position on the list, nominating party, political affiliation, number of preferential votes, and whether they were elected or held specific positions (mayor, deputy mayor, member of the executive body).

The dataset also includes contextual election-level information, such as the number of eligible voters and ballots cast, which can be used to calculate voter turnout and related indicators. These variables appear only once per election and constituency (they may be stored in a single candidate row for that election/constituency)

Source

The dataset was compiled primarily from official election results published by the Czech Statistical Office. Additional contextual or verification information (such as post-election roles) was obtained from publicly available municipal records.

References

Examples

# Basic inspection
str(Nebanice_CH_cz)

# Example of a basic continuity diagram (unformatted version)
plot_continuity(Nebanice_CH_cz, elections = "2010-")

Municipal Election Data: Potucky (KV, CZ)

Description

A dataset containing individual-level candidacy records from municipal elections in the municipality of Potucky (district Karlovy Vary, Czech Republic).

Usage

Potucky_KV_cz

Format

An object of class data.frame with 130 rows and 14 columns.

Details

Dataset overview:
Municipality: Potucky
District: Karlovy Vary
Country: Czech Republic
Number of elections: 8
Elections covered: 1994, 1998, 2002, 2006, 2010, 2014, 2018, 2022
Number of candidacies (rows): 130
Note: Municipality website

Description of variables

Variable Description
elections Election identifiers (numeric)
candidate Candidate's full name (character)
list_name Name of the candidate list (character)
list_pos Candidate's position on the list (numeric)
pref_votes Number of preferential votes (numeric)
elected Logical; TRUE if candidate was elected
nom_party Nominating party (character)
pol_affil Political affiliation (character)
mayor TRUE if elected mayor
dep_mayor TRUE if elected deputy mayor
board TRUE if member of the executive board
gov_support TRUE if supported the local government
elig_voters Number of eligible voters (numeric)
ballots_cast Number of ballots cast (numeric)

Each record describes one candidate's run for office, including their candidate list affiliation, position on the list, nominating party, political affiliation, number of preferential votes, and whether they were elected or held specific positions (mayor, deputy mayor, member of the executive body).

The dataset also includes contextual election-level information, such as the number of eligible voters and ballots cast, which can be used to calculate voter turnout and related indicators. These variables appear only once per election and constituency (they may be stored in a single candidate row for that election/constituency)

Source

The dataset was compiled primarily from official election results published by the Czech Statistical Office. Additional contextual or verification information (such as post-election roles) was obtained from publicly available municipal records.

References

Examples

# Basic inspection
str(Potucky_KV_cz)

# Example of a basic continuity diagram (unformatted version)
plot_continuity(Potucky_KV_cz, elections = "2010-", lists = "elected")

Municipal Election Data: Prameny (CH, CZ)

Description

A dataset containing individual-level candidacy records from municipal elections in the municipality of Prameny (district Cheb, Czech Republic).

Usage

Prameny_CH_cz

Format

An object of class data.frame with 117 rows and 14 columns.

Details

Dataset overview:
Municipality: Prameny
District: Cheb
Country: Czech Republic
Number of elections: 11
Elections covered: 1994, 1998, 2002, 2006, 2009, 2012, 2014, 2015, 2018.01, 2018.10, 2022
Number of candidacies (rows): 117
Note: Municipality website

Description of variables

Variable Description
elections Election identifiers (numeric)
candidate Candidate's full name (character)
list_name Name of the candidate list (character)
list_pos Candidate's position on the list (numeric)
pref_votes Number of preferential votes (numeric)
elected Logical; TRUE if candidate was elected
nom_party Nominating party (character)
pol_affil Political affiliation (character)
mayor TRUE if elected mayor
dep_mayor TRUE if elected deputy mayor
board TRUE if member of the executive board
gov_support TRUE if supported the local government
elig_voters Number of eligible voters (numeric)
ballots_cast Number of ballots cast (numeric)

Each record describes one candidate's run for office, including their candidate list affiliation, position on the list, nominating party, political affiliation, number of preferential votes, and whether they were elected or held specific positions (mayor, deputy mayor, member of the executive body).

The dataset also includes contextual election-level information, such as the number of eligible voters and ballots cast, which can be used to calculate voter turnout and related indicators. These variables appear only once per election and constituency (they may be stored in a single candidate row for that election/constituency)

Source

The dataset was compiled primarily from official election results published by the Czech Statistical Office. Additional contextual or verification information (such as post-election roles) was obtained from publicly available municipal records.

References

Examples

# Basic inspection
str(Prameny_CH_cz)

# Example of a basic continuity diagram (unformatted version)
plot_continuity(Prameny_CH_cz, elections = "2012-")

Municipal Election Data: Roztoky (PZ, CZ)

Description

A dataset containing individual-level candidacy records from municipal elections in the municipality of Roztoky (district Praha-zapad, Czech Republic).

Usage

Roztoky_PZ_cz

Format

An object of class data.frame with 1079 rows and 14 columns.

Details

Dataset overview:
Municipality: Roztoky
District: Praha-zapad
Country: Czech Republic
Number of elections: 8
Elections covered: 1994, 1998, 2002, 2006, 2010, 2014, 2018, 2022
Number of candidacies (rows): 1079
Note: Municipality website

Description of variables

Variable Description
elections Election identifiers (numeric)
candidate Candidate's full name (character)
list_name Name of the candidate list (character)
list_pos Candidate's position on the list (numeric)
pref_votes Number of preferential votes (numeric)
elected Logical; TRUE if candidate was elected
nom_party Nominating party (character)
pol_affil Political affiliation (character)
mayor TRUE if elected mayor
dep_mayor TRUE if elected deputy mayor
board TRUE if member of the executive board
gov_support TRUE if supported the local government
elig_voters Number of eligible voters (numeric)
ballots_cast Number of ballots cast (numeric)

Each record describes one candidate's run for office, including their candidate list affiliation, position on the list, nominating party, political affiliation, number of preferential votes, and whether they were elected or held specific positions (mayor, deputy mayor, member of the executive body).

The dataset also includes contextual election-level information, such as the number of eligible voters and ballots cast, which can be used to calculate voter turnout and related indicators. These variables appear only once per election and constituency (they may be stored in a single candidate row for that election/constituency)

Source

The dataset was compiled primarily from official election results published by the Czech Statistical Office. Additional contextual or verification information (such as post-election roles) was obtained from publicly available municipal records and interviews with local political representatives.

References

Examples

# Basic inspection
str(Roztoky_PZ_cz)

# Example of a basic continuity diagram (unformatted version)
plot_continuity(Roztoky_PZ_cz, elections = "2002-")

Visualization of Candidacy Continuity Diagram

Description

Visualizes the continuity of candidacies over time, illustrating the evolution of the local party system through a network of candidate lists linked by candidate transitions across elections.

Usage

plot_continuity(
  netdata,
  mark = NULL,
  separate_groups = FALSE,
  lists = c("all", "elected"),
  elections = NULL,
  show_elections_between = TRUE,
  parties = NULL,
  links = c("continuity", "all"),
  order_lists_by = c("votes", "seats"),
  order_groups_by = c("elections", "votes", "seats"),
  personalization = FALSE,
  coloured = TRUE,
  group_colours = c(),
  show_legend = TRUE,
  show_candidate_networks = FALSE,
  plot_title = NULL,
  ...
)

Arguments

netdata

A named list created by prepare_network_data containing the continuity network data. Alternatively, a data.frame can also be used, but is recommended only for quick or exploratory plotting of a basic continuity diagram.

mark

Character or character vector. Specifies which type of group should be visually distinguished in the diagram. Options include "parties", "cores", or c("candidate", "candidate name"). Defaults to NULL (no group highlighting). See Details and Examples for usage.

separate_groups

Logical. If TRUE, groups of candidate lists are plotted in separate rows on the y-axis, improving clarity for group-level analysis. See Details.

lists

Character. Candidate lists to be included in the plot. Either "all" (default) or "elected" to include only lists with at least one elected candidate (councillor).

elections

Character or character vector. Filters the range of elections to be shown in the diagram. By default (NULL), all available elections in the netdata object are included. You can specify: individual elections (e.g., ⁠"1994", "2022"⁠), ranges (e.g., "2002-", "-2010", "1994-2010") or combinations of both (e.g., "-1998, 2002, 2003.11, 2018-"). See Details and Examples for more information and usage.

show_elections_between

Logical. If TRUE (default), the plot includes all election periods between those selected via the elections argument, even if no candidate lists are present for those years because of the selection. This is especially useful when visualizing groups that did not run in every election - empty columns help preserve the visual continuity of timelines. Setting this to FALSE will omit those gaps. Recommended to keep TRUE when analyzing individual groups or when filtering only a subset of elections.

parties

Integer or character vector. Filters the so-called political parties, i.e., groups of candidate lists identified via community detection (see prepare_network_data). Use this to display only selected parties, for example: parties = c(1, 3, 5). Party IDs can be found in the network data object under netdata$parties$node_attr$vertices.

links

Character. Determines which links between candidate lists are plotted. "continuity" (default) includes only connections between adjacent elections. "all" includes links across any elections. This option is mainly useful when analyzing a selection of non-consecutive elections.

order_lists_by

Character. Sorts candidate lists within each election vertically. Options are: "votes" (default) or "seats". If separate_groups = TRUE, sorting is applied within each group.

order_groups_by

Character vector. Used when separate_groups = TRUE. Specifies the order of groups on the y-axis. Options: "elections", "votes", "seats", or "none". Multiple criteria can be provided in order of priority. To display groups in the order they are listed in netdata, use "none" or NULL. See Details for more information.

personalization

Logical. If TRUE, appends the coefficient of variation of preferential votes to the candidate list name. See Details for interpretation. Default is FALSE.

coloured

Logical. Specifies whether candidate lists of different groups should be distinguished in colour (TRUE, default) or in grayscale when using the mark argument. Ignored if group_colours is provided.

group_colours

A character vector of colour values (e.g., hex codes or R colour names). Custom colours for marked groups. To maintain the same colours when displaying the diagram repeatedly, the number of colours (elements in the vector) must match the number of all identified groups, even if only a subset is shown. If NULL (default), the function will select the most appropriate colour palette.

show_legend

Logical. Whether to display the legend (only applies when groups are marked). Default is TRUE.

show_candidate_networks

Logical. If TRUE, an additional bottom panel is drawn, displaying a snapshot of the candidate-candidate network for each selected election. Each snapshot shows the network structure of candidates running in that specific election, contextualised by candidates who appeared in previous selected elections (as determined by the elections argument). Default is FALSE. See Details for more information.

plot_title

Character. Title displayed above the diagram. Default is NULL (no title).

...

Additional technical arguments passed internally, primarily for testing and improving the diagram display.

Details

Recommendation about using the raw data

For more advanced use, especially when identifying political parties or analyzing system stability, it is recommended to first process the election data using prepare_network_data. This function builds the necessary network structures and attributes also for groups of candidate lists that sometimes takes few minutes but you would need to do it only once. Using raw data frames as input in case of plot_continuity is intended mainly for quick and basic visualizations, without the group identification.

Usage of mark argument

A central feature of this function is the mark argument, which allows highlighting of specific groups in the diagram. The most common options are "parties" or "cores", referring to communities of candidate lists detected through community detection.

When using mark = "parties" or "cores", you can further specify which groups to highlight visually by adding their IDs (e.g., mark = c("parties", 2, 5)). Party and core IDs are available in netdata$parties$node_attr$vertices or netdata$cores$node_attr$vertices.

You can also highlight individual candidates by using mark = c("candidate", "Candidate Name"), which will highlight the candidate lists on which the person has appeared in colours of the candidate lists' groups.

You may combine the mark argument with group separation, and filtering.

Groups separation

The separate_groups argument improves diagram readability by placing each group on its own line. This is particularly helpful when analyzing continuity, volatility, and structural reproduction of the party system.

Elections filtering

Filtering elections using the elections argument is useful when dealing with many elections that may not fit into a single figure in a report or publication. In such cases, you can split the diagram into two parts (e.g., one with elections = "-2002" and one with elections = "2002-", so that the links between the elections adjacent to the 2002 elections are not lost) and stack them vertically.

When selecting non-consecutive elections, it is strongly recommended to set links = "all" to retain meaningful connections between candidate lists across time. Otherwise, continuity may appear broken due to missing intermediate elections.

For a meaningful continuity analysis, include at least two elections.

About order_groups_by argument

The order_groups_by argument is relevant only when separate_groups = TRUE. You can sort groups by "elections", "votes", "seats", or "none" (the original order in the data). If multiple criteria are provided (e.g., c("votes", "elections")), they are applied in priority order. The criteria of "votes" and "seats" will sort the groups according to the value of the given criterion. The "elections" criterion ranks groups based on their participation in the most recent election and falls back recursively to earlier ones in case of ties.

About personalization argument

The personalization option appends the coefficient of variation of preferential votes to the name of each candidate list. A lower value may indicate a party's electoral program voting, while higher variability may suggest a personalized choice (for example, where voters support a prominent individual rather than the whole candidate list). In the case of a limited number of preferential votes, such an interpretation may be debatable and should therefore be used with caution.

Candidate network snapshots

When show_candidate_networks = TRUE, the plot includes an additional bottom panel visualising candidate-candidate network snapshots for the selected elections.

Each snapshot displays the network of candidates running in that particular election, together with candidates who appeared in earlier selected elections. Candidates in the focal election are drawn as larger nodes, while candidates from previous elections who did not run in that election are shown as smaller background nodes. This allows users to inspect continuity, connectivity, and the gradual formation or dissolution of clusters, as well as other structural changes across electoral periods, even when the selected elections are not consecutive.

If grouping information is available (e.g., community-detected parties or cores), node colours represent the long-term group affiliation of each candidate. Node boundaries, however, reflect the candidate lists used in the specific election represented in each snapshot. This combination helps reveal whether individual candidate lists are internally cohesive or composed of candidates from different longer-term groupings, potentially indicating later fragmentation (splits), mergers, or realignments in subsequent elections.

The candidate network snapshots can also be combined with mark = c("candidate", "<name>"), which highlights the chosen candidate across the continuity diagram and in all snapshot networks. Marking works both with and without identified groupings.

The snapshots do not require the selected elections to be consecutive; if non-adjacent elections are included, the panel still displays one snapshot per election based on the available data.

Additional arguments (...)

The ... argument is primarily intended for internal tuning and advanced use. It can be used to pass optional control parameters that are not part of the main user-facing interface and are therefore not listed in the formal argument list. These settings may change between versions and should generally not be needed in typical workflows.

One such option is do_not_print_to_console = TRUE, which suppresses informational messages printed by plot_continuity() (for example, list of detected groups). This can be useful in automated scripts, examples, or pkgdown documentation where repeated console output would be distracting.

Text encoding

Text encoding is controlled by a global option lpanda.text_encoding with values "auto"|"utf8"|"ascii" (default "auto"). If needed, text_encoding can be passed via ..., e.g. plot_continuity(netdata, text_encoding="ascii").

Value

NULL, invisibly. Called for its side effect: plotting the continuity diagram.

Note

The mark = "cores" option is currently experimental, as the conversion of their definition into code is still being sought, and may be subject to change in future versions. Use with caution.

Examples

data(sample_data, package = "lpanda")

# basic continuity diagram
plot_continuity(sample_data)

# preparing network data
netdata <- prepare_network_data(sample_data, verbose = FALSE, quick = TRUE)

# highlighting groups
plot_continuity(netdata, mark = "parties")

plot_continuity(
  netdata,
  mark = c("parties", 3),
  order_lists_by = "seats",
  do_not_print_to_console = TRUE
)

plot_continuity(
  netdata,
  mark = "parties",
  separate_groups = TRUE,
  show_legend = FALSE,
  do_not_print_to_console = TRUE
)

# candidate network snapshots coloured by groups and bordered by lists
plot_continuity(
  netdata,
  mark = "parties",
  show_candidate_networks = TRUE,
  do_not_print_to_console = TRUE
)

# candidate tracking
plot_continuity(
  netdata,
  mark = c("candidate", "c03"),
  show_candidate_networks = TRUE,
  do_not_print_to_console = TRUE
)

# filtering elections and parties
plot_continuity(
  netdata,
  mark = "parties",
  elections = "18-",
  do_not_print_to_console = TRUE
)

plot_continuity(
  netdata,
  elections = c(14, 22),
  links = "all",
  show_elections_between = FALSE
)

plot_continuity(netdata, parties = 1)


Prepare Network Data for LPANDA

Description

Transforms time series data of local election results into a set of network data for use in Local Political Actor Network Diachronic Analysis (LPANDA). The function constructs a bipartite network (candidate – candidate list), its projected one-mode networks (candidate – candidate and list – list), a continuity graph (linking candidate lists between adjacent elections), and an elections network (its node attributes can serve as electoral statistics). It also detects parties (as clusters of candidate lists based on community detection applied to the bipartite network) and constructs their network.

Usage

prepare_network_data(df, input_variable_map = list(), verbose = TRUE, ...)

Arguments

df

A data.frame containing data from elections, with one row per candidate. The function also accepts a single election, though diachronic outputs will then be empty or trivial. See the Expected structure of input data section for the expected data format and required variables.

input_variable_map

A list mapping variable names in df that differ from the expected ones:

elections = unique election identifiers (numeric),
candidate = candidate's name used as a unique identifier (character),
list_name = name of the candidate list (character),
list_pos = candidate's position on the list (numeric),
pref_votes = preferential votes received by the candidate (numeric),
list_votes = * total votes received by the candidate list (numeric),
elected = whether the candidate was elected (logical),
nom_party = party that nominated the candidate (character),
pol_affil = declared political affiliation of the candidate (character),
mayor = whether the councillor became mayor (logical),
dep_mayor = whether the councillor became deputy mayor (logical),
board = whether the councillor became a member of the executive board (logical),
gov_support = whether the councillor supported the executive body (logical),
elig_voters = * number of eligible voters (numeric),
ballots_cast = * number of ballots cast (numeric),
const_size = * size of the constituency (number of seats) (numeric)

* Variables marked with an asterisk should appear only once per election and constituency — in the row of any one candidate running in that specific elections and constituency.

See the Expected input data structure section to find out how to use it.

verbose

Logical, default TRUE. If FALSE, suppresses informative messages.

...

Optional arguments reserved for internal development, experimental features and future extensions, such as include_cores (logical, default FALSE). Not intended for standard use yet (behavior may change without notice). Unknown keys in ... are ignored.

Value

A list of network data objects for diachronic analysis using LPANDA or other social network analysis tools. Each component contains edgelist (data.frame of edges) and node_attr (data.frame of node attributes). The exact set of columns depends on the input and may evolve. See Output data structure for a description of the returned object.

Expected structure of input data

The input data frame (df) must include at least the election identifiers (year[.month]), candidates' names (uniquely identifying individuals), and list names. Other variables are optional. If variable names in the dataset differ from the expected ones, they should be specified in the input_variable_map as a named list (only differing names need to be listed).

Just in case - a named list is a list where each element has a name (the expected variable name) and a value (the actual name used in your data frame), for example: list(list_name = "party", elected = "seat", list_votes = "votes_total").

Examples of expected and acceptable values in df:

If pref_votes are present but list_votes are not, the function assumes a voting system where list votes are calculated by summing the preferential votes of candidates on the list.

If const_size is missing, it will be estimated based on the number of elected candidates (if available).

For the purposes of analysis, a new variable list_id (class character) is added to the internally processed copy of df and carried to the output. It uniquely identifies each candidate list in a given election (combining list_name and elections), e.g., Besti Flokkurinn (2010), SNP (2019), or "John Smith (5), IND. (2022.11)". This variable serves as a key identifier in LPANDA for tracking candidate lists across elections and constructing network relations.

Output data structure

The returned object is a named list with up to seven network objects:

Each object is a list with two components:

For example, ...$candidates$edgelist contains edges between individuals who appeared on the same candidate list, and ...$elections$node_attr includes several election statistics (e.g., number of candidates, distributed seats, plurality index, voter turnout for each election, etc.).

Note

Cores are currently experimental, as the conversion of their definition into code is still being sought, and may be subject to change in future versions. It is not yet intended for standard use in analyses and academic studies, since their calculation is not yet comprehensive, so the cores' network structure will not appear in the standard output network data unless explicitly called with the include_cores = TRUE parameter. Use with caution, their interpretation is highly questionable.

Examples

data(sample_different_varnames, package = "lpanda")
df <- sample_different_varnames
str(df) # different variable names: "party" and "seat"
input_variable_map <- list(list_name = "party", elected = "seat")

netdata <- prepare_network_data(df, input_variable_map, verbose = FALSE)
str(netdata, vec.len = 1)



Sample Dataset with Binary Values

Description

A variant of sample_data containing binary values (0/1) instead of TRUE/FALSE values. This is useful for testing functions that must correctly interpret both logical and numeric binary formats.

Usage

sample_binary_values

Format

A data frame with 18 rows and 5 variables (same structure as sample_data).

Source

Fictitious data

Examples

# Basic inspection
str(sample_binary_values)

# Quick continuity diagram (basic and unformatted version)
plot_continuity(sample_binary_values)

Simple Sample Dataset

Description

Basic fictitious dataset simulating election results.

Usage

sample_data

Format

A data frame with 18 rows and 5 variables:

elections

Election identifier (numeric)

candidate

Candidate identifier (character)

list_name

Candidate list name (character)

elected

Logical; TRUE if the candidate was elected

mayor

Logical; TRUE if the candidate became mayor

Source

Fictitious data

Examples

# Basic inspection
str(sample_data)

# Quick continuity diagram (basic and unformatted version)
plot_continuity(sample_data)

Sample Dataset with Some Different Variable Names

Description

A variant of sample_data in which some variables have different names (list_name becomes party and elected becomes seat). This is useful for testing robustness of input handling.

Usage

sample_different_varnames

Format

A data frame with 18 rows and 5 variables (same structure as sample_data).

Source

Fictitious data

Examples

# Basic inspection
str(sample_different_varnames)

# Quick continuity diagram (basic and unformatted version)
net <- prepare_network_data(sample_different_varnames,
                                      input_variable_map = list(list_name = "party",
                                                                elected = "seat"),
                                      verbose = FALSE,
                                      skip_groups = TRUE)
plot_continuity(net)

Sample Dataset Without Continuity Between Elections

Description

A variant of sample_data in which no candidate appears in more than one election. This breaks the continuity between elections, making the dataset useful for testing whether network-building functions correctly handle cases with no longitudinal links across candidate lists.

Usage

sample_no_continuity

Format

A data frame with 15 rows and 5 variables (same structure as sample_data).

Source

Fictitious data

Examples

# Basic inspection
str(sample_no_continuity)

# Quick continuity diagram (basic and unformatted version)
plot_continuity(sample_no_continuity)

Sample Dataset Without Party Pluralism (only one candidate list per election)

Description

A variant of sample_data in which only one candidate list is running in each election. This removes party pluralism from the party system, making the dataset useful for testing functions under non-competitive conditions.

Usage

sample_no_pluralism

Format

A data frame with 9 rows and 5 variables (same structure as sample_data).

Source

Fictitious data

Examples

# Basic inspection
str(sample_no_pluralism)

# Quick continuity diagram (basic and unformatted version)
plot_continuity(sample_no_pluralism)

Sample Dataset Without Candidate Switching

Description

A variant of sample_data in which candidates may run in multiple elections, but always remain within the same political group. In other words, they never switch between candidate list clusters, which makes the dataset useful for testing continuity logic under stable group membership (verifying that no cross-group transitions occur).

Usage

sample_no_switching

Format

A data frame with 15 rows and 5 variables (same structure as sample_data).

Source

Fictitious data

Examples

# Basic inspection
str(sample_no_switching)

# Quick continuity diagram (basic and unformatted version)
plot_continuity(sample_no_switching)