| 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 |
| 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
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:
-
prepare_network_data() - prepares network objects from municipal election results. -
plot_continuity() - creates continuity diagrams of local political actors' candidacies over time.
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:
Report bugs at https://github.com/localpolitics/lpanda/issues
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
Hornek, J. (2022). Zhroucene obce v Ceske republice (Failed Municipalities in the Czech Republic). Dissertation thesis. Charles University. [Full text]
Hornek, J., & Juptner, P. (2020). Endangered Municipalities? Case Study of Three Small and Critically Indebted Czech Municipalities. NISPAcee Journal of Public Administration and Policy, 13(1), 35-59. [Full text]
Hornek, J. (2016). Politicke dopady zadluzovani malych obci v Ceske republice (Political Impacts of Indebtedness of Small Municipalities in the Czech Republic). Prague: Sociologicke nakladatelstvi (SLON). [Publisher link]
Hornek, J. (2014). Politicke dopady zadluzovani malych obci v CR (Financing of Small Municipalities in the Czech Republic and its Political Impact). Master thesis. Charles University. [Full text]
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
Muller, K. B. (2018). Dobre vladnuti ve verejnem nezajmu. Lokalni politicke elity jako klicovi akteri demokratizace? (Good Governance in Public Disinterest. Local Political Elites as Key Actors of Democratization?). Prague: Sociologicke nakladatelstvi (SLON). [Publisher link]
Muller, K. B. (2018). Dobre vladnuti a jeho akteri v postkomunistickem happyvillu aneb jak rozhodovat v zajmu tech, kteri nejsou slyset (Good governance and its actors in a post-communist happyville. How to govern in favour of those who remain salient). Acta Politologica 10(1), 57-85. [Full text]
Formackova, M. (2013). Vyvoj mistni samospravy v obci Cernosice (The Development of Local Government in the Municipality of Cernosice). Master thesis. Czech University of Life Sciences Prague. [Full text]
Hausmannova, H. (2011). Obcanska spolecnost a politicke elity na komunalni urovni (Civil Society and Political Elites on Local Level). Bachelor thesis. Prague University of Economics and Business. [Full text]
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
Krpalkova, S. (2024). Permanentni opakovani komunalnich voleb: zablokovane obce? (Permanent repetition of municipal election: blocked municipalities?). Dissertation thesis. Charles University. [Full text]
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.
Bubenicek, V. (2009). Doubice. In Cmejrek, J. et al., Participace obcanu na verejnem zivote venkovskych obci CR (Citizens' Participation in the Public Life of Rural Municipalities in the Czech Republic). Prague: Kernberg Publishing.
References
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]
Cmejrek, J. et al. (2009). Participace obcanu na verejnem zivote venkovskych obci CR (Citizens' Participation in the Public Life of Rural Municipalities in the Czech Republic). Prague: Kernberg Publishing.
Bubenicek, V. (2009). Aplikace indexu plurality na lokalni politicke urovni (The Application of the Plurality Index in the Local Politics). In Svatos, M., Lostak, M., & Zuzak, R. (Eds.) Sbornik praci z mezinarodni vedecke konference Agrarni perspektivy XVIII. Strategie pro budoucnost. Prague: FEM CZU Prague.
Bubenicek, V., Copik, J., Hajny, P., Kopriva, R., & Neumanova, T. (Eds.) (2005). Obce jako akteri politickeho procesu: komunitni studie regionalnich politickych systemu a problematika metodiky jejich zpracovani (Municipalities as Actors of the Political Process: Case Studies of Regional Political Systems and Methodology of Their Elaboration). Prague: FEM CZU Prague.
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.
Kadlecova, S. (2013). Lokalni stranicky system v obci Horomerice (Local Party System in the Municipality of Horomerice). Bachelor thesis. Czech University of Life Sciences Prague. [Full text]
Bares, M. (2009). Spolecensky a politicky zivot v obci Horomerice (The Public Life and the Political Process in Horomerice). Bachelor thesis. Czech University of Life Sciences Prague. [Full text]
References
Vobecka, J., & Kostelecky, T. (Eds.) (2007). Politicke dusledky suburbanizace. (Political Consequences of Suburbanization). Prague: Institute of Sociology of the Czech Academy of Sciences. [Full text]
Kadlecova, S. (2013). Lokalni stranicky system v obci Horomerice (Local Party System in the Municipality of Horomerice). Bachelor thesis. Czech University of Life Sciences Prague. [Full text]
Maxa, D. (2024). Formovani organu mistni samospravy v obci Horomerice. (The process of Setting Up the Local Government in the Municipality of Horomerice). Bachelor thesis. Czech University of Life Sciences Prague. [Full text]
Novakova, N. (2025). Politicke aspekty rizeni a rozvoje vybrane obce (pripadova studie obce Horomerice) (Political Aspects of Management and the Development of the Chosen Municipality (Case Study of Horomerice). Bachelor thesis. Czech University of Life Sciences Prague. [Full text]
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
Krpalkova, S. (2024). Permanentni opakovani komunalnich voleb: zablokovane obce? (Permanent repetition of municipal election: blocked municipalities?). Dissertation thesis. Charles University. [Full text]
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.
Pohlreich, D. (2023). Vyvoj mistni samospravy ve meste Jilove (The Development of Local Government in the Municipality of Jilove). Diploma thesis. Czech University of Life Sciences Prague. [Full text]
References
Pohlreich, D. (2023). Vyvoj mistni samospravy ve meste Jilove (The Development of Local Government in the Municipality of Jilove). Diploma thesis. Czech University of Life Sciences Prague. [Full text]
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.
Kotaskova, S. (2012). Politicky proces v obci Kamenna (The Political Process in the Municipality of Kamenna). Master thesis. Czech University of Life Sciences Prague. [Full text]
References
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.
Kotaskova, S. (2012). Politicky proces v obci Kamenna (The Political Process in the Municipality of Kamenna). Master thesis. Czech University of Life Sciences Prague. [Full text]
Kotaskova, S. (2010). Analyza lokalniho stranickeho systemu v obci Kamenna (Analysis of the Local Party System in the Kamenna Municipality). Bachelor thesis. Czech University of Life Sciences Prague. [Full text]
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
Hornek, J., & Juptner, P. (2020). Endangered Municipalities? Case Study of Three Small and Critically Indebted Czech Municipalities. NISPAcee Journal of Public Administration and Policy, 13(1), 35-59. [Full text]
Hornek, J. (2016). Politicke dopady zadluzovani malych obci v Ceske republice (Political Impacts of Indebtedness of Small Municipalities in the Czech Republic). Prague: Sociologicke nakladatelstvi (SLON). [Publisher link]
Hornek, J. (2014). Politicke dopady zadluzovani malych obci v CR (Financing of Small Municipalities in the Czech Republic and its Political Impact). Master thesis. Charles University. [Full text]
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
Hornek, J. (2017). Komunalni politika v malych bohatych obcich v Ceske republice: politicke souboje o zastupitelska kresla ci vsestranna kooperace ve prospech obci? (Local Government in Small Rich Municipalities in the Czech Republic: Political Battles for the Chairs of Representatives or Versatile Cooperation for the Benefits of Municipalities?). Scientia et Societas, 13(4), 115-143. [Full text]
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
Hornek, J. (2022). Zhroucene obce v Ceske republice (Failed Municipalities in the Czech Republic). Dissertation thesis. Charles University. [Full text]
Hornek, J., & Juptner, P. (2020). Endangered Municipalities? Case Study of Three Small and Critically Indebted Czech Municipalities. NISPAcee Journal of Public Administration and Policy, 13(1), 35-59. [Full text]
Hornek, J. (2019). Endangered European Municipalities: A Systematic Outline of the Problem and Its Political Impact. Politics in Central Europe, 15(2), 219-256. [Full text]
Hornek, J. (2016). Politicke dopady zadluzovani malych obci v Ceske republice (Political Impacts of Indebtedness of Small Municipalities in the Czech Republic) [Publisher link]
Hornek, J. (2014). Politicke dopady zadluzovani malych obci v CR (Financing of Small Municipalities in the Czech Republic and its Political Impact). Master thesis. [Full text]
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
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]
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 |
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 ( |
show_elections_between |
Logical. If TRUE (default), the plot includes
all election periods between those selected via
the |
parties |
Integer or character vector. Filters the so-called political
parties, i.e., groups of candidate lists identified via community
detection (see |
links |
Character. Determines which links between candidate lists are
plotted. |
order_lists_by |
Character. Sorts candidate lists within each election
vertically. Options are: "votes" (default) or "seats".
If |
order_groups_by |
Character vector. Used when |
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 |
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 |
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 |
verbose |
Logical, default TRUE. If FALSE, suppresses informative messages. |
... |
Optional arguments reserved for internal development, experimental
features and future extensions, such as |
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:
-
elections(required): Election identifier in the format YY[YY][.MM]: e.g., 94 | 02 | 1998 | "2024" | 2022.11 -
candidate(required): e.g., "John Doe" | "John Smith (5)" | "Jane Doe, jr." -
list_name(required): for independent candidates, you can use: e.g., "John Smith, Independent Candidate" | "J.S., IND." -
list_pos,pref_votes,list_votes: must be numeric -
elected,mayor,dep_mayor,board,gov_support: 1 | "0" | T | "F" | "TRUE" | FALSE (non‑logical inputs will be coerced to logical). -
nom_party: for independent candidates, you can use: "IND" | "Independent Candidate" -
pol_affil: for independent candidates, you can use: "non-partisan" -
elig_voters,ballots_cast,const_size: A numeric that should appear only once in any candidate row within a given election and constituency
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:
-
bipartite: bipartite network (candidates-lists). -
candidates: projected candidate–candidate network. -
lists: projected list–list network (directed by election order). -
continuity: filtered version oflistsnetwork (edges of adjacent elections only). -
parties: network of detected party clusters (via community detection applied onbipartitenetwork). (
cores): higher-level clusters ofparties. Cores are currently experimental and will not appear in the standard output network data. See Note.-
elections: inter-election candidate flow and election-level stats
Each object is a list with two components:
-
edgelist: a data.frame representing network edges -
node_attr: a data.frame with attributes for each node
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;
TRUEif the candidate was elected- mayor
Logical;
TRUEif 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)