polls {nzelect}R Documentation

New Zealand Opinion Polls

Description

Opinion polling of voting intention for New Zealand general elections

Usage

polls

Format

A data frame of 7 columns

Details

Intended party vote. Note the original source says 'Refusals are generally excluded from the party vote percentages, while question wording and the treatment of "don't know" responses and those not intending to vote may vary between survey organisations.'

EndData and StartDate refer to the data collection period. These dates were entered by hand, use with caution and check against the WikipediaDates column which is the version from the original source.

Where the date in Wikipedia is given only as "released on X", the start and end dates have been deemed to be two days before release.

The data for the 2005 election are particularly unreliable and in some cases it is not clear whether some parties have been omitted. For example, the Digipoll from 22 March to 30 March 2005 has figures only for National and Labour (47.5 and 34.5).

Source

https://en.wikipedia.org/wiki/Opinion_polling_for_the_New_Zealand_general_election,_2005 https://en.wikipedia.org/wiki/Opinion_polling_for_the_New_Zealand_general_election,_2008 https://en.wikipedia.org/wiki/Opinion_polling_for_the_New_Zealand_general_election,_2011 https://en.wikipedia.org/wiki/Opinion_polling_for_the_New_Zealand_general_election,_2014 https://en.wikipedia.org/wiki/Opinion_polling_for_the_New_Zealand_general_election,_2017

Examples

if(require(ggplot2) & require(scales) & require(dplyr) & require(forcats)){
election_dates <- polls %>%
    filter(Pollster == "Election result") %>%
    select(MidDate) %>%
    distinct()

polls %>%
    filter(Party %in% c("National", "Labour", "Green", "NZ First")) %>%
    mutate(Party = fct_reorder(Party, VotingIntention, .desc = TRUE),
           Pollster = fct_relevel(Pollster, "Election result")) %>%
    ggplot(aes(x = MidDate, y = VotingIntention, linetype = Pollster)) +
    geom_line(alpha = 0.5) +
    geom_point(aes(colour = Client), size = 0.7) +
    geom_smooth(aes(group = Party), se = FALSE, colour = "grey15", span = .20) +
    scale_y_continuous("Voting intention", label = percent) +
    scale_x_date("") +
    facet_wrap(~Party, scales = "free_y") +
    geom_vline(xintercept = as.numeric(election_dates$MidDate), colour = "grey80") 
}

[Package nzelect version 0.4.0 Index]