Giter VIP home page Giter VIP logo

scgelectionsnz's Introduction

scgElectionsNZ

Release R-CMD-check codecov

Overview

scgElectionsNZ is an R package providing comprehensive data and tools for analyzing New Zealand’s general election results from 1996 to 2023. It offers a unique insight into the dynamics of the electoral process in New Zealand, presented through a variety of datasets and functions.

Datasets Included:

  • summary: National-level overall results by party.
  • turnout: Electorate and ballot type-specific turnout and informal vote details.
  • vote_type: Validity and method of votes by electorate and ballot.
  • party_votes: Party votes at the electorate level.
  • candidate_votes: Candidate votes at the electorate level.
  • majority: Winning candidates and their margins of victory at the electorate level.
  • split_electorate: Electorate-level split-ticket voting data (2005 - 2023).
  • split_total: National-level split-ticket voting data (2005 - 2023).
  • preMMP_results: National-level results from 1890 to 1993, before MMP.
  • historic_turnout: National-level turnout data from 1879 to 2023.

Installation

To install the development version of scgElectionsNZ, use:

# Install the development version from GitHub
devtools::install_github("sarahcgall/scgElectionsNZ")

Usage

scgElectionsNZ includes several helper functions to enhance data analysis:

  • add_data(): Enhances datasets with regional or electorate type information.
  • update_names(): Standardises electorate names for consistent analysis across years or condense unsuccessful party names into "Other" for easier analysis.

Example usage:

library(scgElectionsNZ)

# Load a dataset
df <- scgUtils::get_data("majority")

# Add additional data
df <- add_data(df, output="regions")
df <- add_data(df, output="type")

# Standardise names
df <- update_names(df, output = "electorate")
df <- update_names(df, output = "party")

Explore detailed examples and dataset descriptions in the package documentation.

Data Sources and Disclaimer

Data Sources

The datasets in the scgElectionsNZ package are meticulously curated from the official results sourced from the New Zealand Electoral Commission. These datasets offer a comprehensive view of New Zealand's electoral outcomes and are crucial for in-depth analysis and research in political science, electoral studies, and related fields.

Disclaimer

While the utmost care has been taken to ensure the accuracy and reliability of the data, the New Zealand Electoral Commission was not involved in the development of this package and thus does not bear responsibility for any errors or omissions in the datasets. Users of scgElectionsNZ should note that the package's creators have independently compiled, processed, and presented the data. Any discrepancies or inaccuracies found within the datasets do not reflect on the official records maintained by the Electoral Commission.

Currency of Data

The data included in this package are up-to-date as of 3 December 2023. Users should be aware that subsequent electoral events or data revisions by the Electoral Commission after this date may not be reflected in the current version of scgElectionsNZ.

Future Additions and Updates

Planned future additions include by-election and referendum results and enhanced datasets like results_by_booths. Upcoming functional updates will focus on visualising election results specific to New Zealand and making boundary adjustments for better comparative analysis.

Feedback and Contributions

Suggestions and contributions are welcome. For any proposed additions, amendments, or feedback, please create an issue.

Related Packages

Check out scgUtils for additional functions and visualisation tools.

scgelectionsnz's People

Contributors

sarahcgall avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.