Skip to content

Instantly share code, notes, and snippets.

@thoughtfulbloke
Created September 24, 2017 03:35
Show Gist options
  • Save thoughtfulbloke/bc4aa5146ae44e258f8afdc8ae912004 to your computer and use it in GitHub Desktop.
Save thoughtfulbloke/bc4aa5146ae44e258f8afdc8ae912004 to your computer and use it in GitHub Desktop.
#2017 NZ electorate candidates
library(dplyr)
library(tidyr)
library(ggplot2)
library(ggridges)
# from
listText <- "party firstname surname
National Kanwaljit Singh Bakshi
National Tim van de Molen
Human Rights Party Anthony van den Heuvel
Opportunities Jessica Hammond Doube
Māori Tuilagi Saipele Esera
Māori Te Ururoa Flavell
Green Julie Anne Genter
Opportunities Ted Faleauto Johnston
Legalise Cannabis Emma-Jane Mihaere Kingi
Green Ricardo Menendez March
ACT Brooke Van Velden
Democrats Hessel Van Wieren
ACT Bruce Carley
ACT Sam Singh
ACT Toni Severin
ACT Vineet Shiriwastow
ACT Sam Purchas
ACT Dan Doughty
ACT Stephen Berry
ACT David Seymour
ACT James McDowall
ACT Alex Evans
ACT Anthony Smith
ACT Andy Parkins
ACT Paul Gilbert
ACT Richard Evans
ACT Shan Ng
ACT Bhupinder Singh
ACT Sam Singh
ACT Paul Hufflett
ACT Richard Wells
ACT Anneka Carlson
ACT Nick Kearney
ACT Tim Kronfield
ACT Bruce Haycock
ACT Craig Nelson
ACT Andie Moore
ACT Wayne Grattan
ACT David Fox
ACT Tom Corbett
ACT Neil Wilson
ACT Grae O'Sullivan
ACT Beth Houlbrooke
ACT Chris Sole
ACT Brian Davidson
ACT Michael Milne
ACT Stuart Pedersen
ACT Stephen Fletcher
ACT Bruce Haycock
ACT Tim Kronfeld
ACT Stuart Hawkins
ACT Roger Greenslade
ACT Michael Warren
ACT Zeb Markland
ACT Alan Davidson
ACT Colin Anderson
ACT Robin Grieve
ACT Ruth Knights
Ban 1080 Brian Adams
Ban 1080 Clyde Graf
Ban 1080 Peter Salter
Climate First Leslie Jones
Communist League Felicity Coggan
Communist League Michael Tucker
Conservative Stephen Greenfield
Conservative Chris Brosnan
Conservative Lachlan Ashton
Conservative Leighton Baker
Conservative Brendan Whyte
Conservative Martin Frauenstein
Conservative David Greenslade
Conservative Warren Knott
Conservative Kevin Stitt
Conservative Elliot Ikilei
Conservative Jeffrey Johnson
Conservative Kathryn Davie
Conservative Laurence Day
Conservative Simon Gutschlag
Conservative Paul Davie
Conservative Melanie Taylor
Conservative Roger Larkins
Conservative Cedric Backhouse
Conservative Philip Lynch
Conservative Bruce Welsh
Conservative Owen Patterson
Conservative Allan Thomson
Conservative Denis Shuker
Conservative Marilyn Johnson
Conservative Roger Larkins
Conservative Benjamin Price
Conservative Raymond Lum
Conservative Jim Taylor
Democrats Tracy Livingston
Democrats Mischele Rhodes
Democrats John McCaskey
Democrats Andrew Leitch
Democrats Karl Matthys
Democrats Barry Pulford
Democrats Scott Macarthur
Democrats Tricia Cheel
Democrats David Wilson
Democrats Gary Gribben
Democrats John Pemberton
Democrats Jason Jobsis
Democrats Dick Ryan
Democrats Carolyn McKenzie
Democrats Peter Adcock-White
Democrats Jack Collin
Democrats Chris Leitch
Democrats John Ring
Economic Euthenics Tubby Hansen
Future Youth Allister Tosh
GOdsownNZ Claire Holley
Green Denise Roche
Green Julie Zhu
Green Peter Richardson
Green Dora Langsbury
Green Cathy Sweet
Green Rachael Goldsmith
Green Scott Summerfield
Green Niki Bould
Green Shane Gallagher
Green Gareth Hughes
Green Nicholas Mayne
Green Barry Coates
Green Sam Taylor
Green Jo Wrigley
Green Hayley Holt
Green Phil McCabe
Green Virginia Horrocks
Green Susanne Ruthven
Green David Lee
Green Rochelle Surendran
Green Richard McCubbin
Green Jan Logie
Green Elaine Dyett
Green Raj Singh
Green Teanau Tuiono
Green Chlöe Swarbrick
Green Damon Rusden
Green Matt Lawrey
Green Leilani Tamu
Green Stuart Bramhall
Green Kennedy Graham
Green Rebekah Jaung
Green Peter Hughes
Green David Clendon
Green Tane Woodley
Green Sam Ferguson
Green Guy Hunt
Green Thomas Nash
Green Eugenie Sage
Green Mojo Mathers
Green Robin McCandless
Green Stefan Grand-Meyer
Green Harrison Burnard
Green Teall Crossen
Green Richard Gillies
Green Chrys Horn
Green Richard Leckinger
Green Robert Moore
Green Julie Sandilands
Green Emma-Leigh Hodge
Green Golriz Ghahraman
Green Chris Perley
Green James Goodhue
Green Philippa Stevenson
Green Nikki Berry
Green John Hart
Green Patrick Wall
Green James Shaw
Green Kate Fulton
Green Nicola Patrick
Green Ash Holwell
Green Richard Wesley
Green Elizabeth Kerekere
Green Marama Davidson
Green Jack McDonald
Green Godfrey Rudolph
Green Metiria Turei
Independent Joe Stringer
Independent Adrian Graamans
Independent Stan Lusby
Independent Tekawe Ratu
Independent Roger Stratford
Independent Vin Tomar
Independent Ian Cummings
Independent Dorothy Fox
Independent Martin Francis
Independent Raf Manji
Independent Gordon Marshall
Independent Tamatoa Richmond
Independent Bruce Stockman
Independent Bishrul Izadeen
Independent Basil Lawrence
Independent Sam Jennings
Independent Rachel Clark
Independent Penny Bright
Independent Rusty Kane
Independent Yvette Lamare
Independent Hugh Robb
Independent Tua Schuster
Independent Destiny Wiringi
Independent James Harold
Independent Gayaal Iddamalgoda
Independent Peter Robinson
Independent Steven Wilkinson
Independent Marie Minhinnick
Independent Geoff McTague
Independent Wikitoria Waitai-Rapana
Labour Helen White
Labour Angie Warren-Clark
Labour Tofik Mamedov
Labour Duncan Webb
Labour Poto Williams
Labour Cherie Chapman
Labour Nathaniel Blomfield
Labour David Clark
Labour Clare Curran
Labour Kiri Allan
Labour Naisi Chen
Labour Rohan Lord
Labour David Parker
Labour Jamie Strange
Labour Gaurav Sharma
Labour Sue Moroney
Labour Kurt Taogaga
Labour Baljit Kaur
Labour Ginny Andersen
Labour Trevor Mallard
Labour Anthony Rimell
Labour Liz Craig
Labour Janette Walker
Labour Carmel Sepuloni
Labour Kris Faafoi
Labour William Sio
Labour Jenny Salesa
Labour Louisa Wall
Labour Priyanca Radhakrishnan
Labour Jacinda Ardern
Labour Michael Wood
Labour Stuart Nash
Labour Rachel Boyack
Labour Deborah Russell
Labour David Cunliffe
Labour Corie Haddock
Labour Romy Udanga
Labour Shanan Halbert
Labour Willow-Jean Prime
Labour Greg O'Connor
Labour Rob McCann
Labour Barry Kirker
Labour Iain Lees-Galloway
Labour Jesse Pabla
Labour Ruth Dyson
Labour Jo Luxton
Labour Heather Warren
Labour Chris Hipkins
Labour Marja Lubeck
Labour Paul Eagle
Labour Annette King
Labour Ben Sandford
Labour Tony Condon
Labour Sam McDonald
Labour Hilary Humphrey
Labour Al'a Al-Bustanji
Labour Jan Tinetti
Labour Phil Twyford
Labour Anna Lorck
Labour Jin An
Labour Brooke Loader
Labour Dan Rosewarne
Labour Kieran McAnulty
Labour Zelie Allan
Labour Grant Robertson
Labour Damien O'Connor
Labour Steph Lewis
Labour Tony Savage
Labour Megan Woods
Labour Nanaia Mahuta
Labour Meka Whaitiri
Labour Peeni Henare
Labour Adrian Rurawhe
Labour Kelvin Davis
Labour Rino Tirikatene
Labour Tamati Coffey
Legalise Cannabis Janine Shufflebotham
Legalise Cannabis Paula Lambert
Legalise Cannabis Adrian McDermott
Legalise Cannabis Jeff Lye
Legalise Cannabis Maki Herbert
Legalise Cannabis Maki Herbert
Logic Party Miriam Clements
Mana James Papali'i
Mana Hone Harawira
Māori Raewyn Bennett
Māori Wetex Kang
Māori Rihi Vercoe
Māori Boris Samujh
Māori Cinnamon Whitlock
Māori Esther Tofilau-Tevaga
Māori Tasha Hohaia
Māori Manase Lua
Māori John Kiria
Māori Maryanne Marsters
Māori Karen Williams
Māori Carrie Stoddart-Smith
Māori Raewyn Bhana
Māori Wendy Biddle
Māori Mele Pepa
Māori Joseph Borell
Māori Aroha Reriti-Crofts
Māori Rahui Papa
Māori Marama Fox
Māori Shane Taurima
Māori Howie Tamati
Māori Mei Reedy-Taare
Money Free Party Richard Osmaston
Money Free Party Andrew Scott
Money Free Party Liam Anderson
National Nikki Kaye
National Todd Muller
National Jami-Lee Ross
National Nicky Wagner
National Jo Hayes
National Hamish Walker
National Todd Barclay
National Scott Simpson
National Michael Woodhouse
National Matt Gregory
National Anne Tolley
National Erica Stanford
National Murray McCully
National Paul Goldsmith
National David Bennett
National Tim Macindoe
National Chris Penk
National John Key
National Andrew Bayly
National Chris Bishop
National Gerry Brownlee
National Sarah Dowie
National Stuart Smith
National Bala Beeram
National Euon Murrell
National Agnes Loheni
National Katrina Bungard
National Denise Lee
National Sam Lotu-Iiga
National Melissa Lee
National Parmjeet Parmar
National David Elliott
National Nick Smith
National Paulo Garcia
National Jonathan Young
National Maggie Barry
National Jonathan Coleman
National Matt King
National Brett Hudson
National Nathan Guy
National Simeon Brown
National Maurice Williamson
National Adrienne Pierce
National Judith Collins
National Nuk Korako
National Andrew Falloon
National Jo Goodhew
National Ian McKelvie
National Carolyn O'Fallon
National Mark Mitchell
National Chris Finlayson
National Todd McClay
National Amy Adams
National Simon O'Connor
National Barbara Kuriger
National Louise Upston
National Simon Bridges
National Alfred Ngaro
National Lawrence Yule
National Craig Foss
National Paula Bennett
National Lindsay Tisch
National Matthew Doocey
National Alastair Scott
National Jacqui Dean
National Nicola Willis
National Maureen Pugh
National Harete Hipango
National Chester Borrows
National Shane Reti
National David Hiatt
Not A Party Richard Goode
Not a Party Simon Smythe
Not A Party Bob Wessex
NZ First Frank Edwards
NZ First Lester Gray
NZ First Phil Robinson
NZ First Melanie Mark-Shadbolt
NZ First Mark Patterson
NZ First Anne-Marie Andrews
NZ First Warren Voight
NZ First Kerry Rushton
NZ First Julian Tilley
NZ First Ilja Ruppeldt
NZ First Julian Paul
NZ First Pita Paraone
NZ First Shayne Wihongi
NZ First Helen Peterson
NZ First Jon Reeves
NZ First Alok Gupta
NZ First Ria Bond
NZ First Jamie Arbuckle
NZ First Anne Degia-Pala
NZ First Randall Ratana
NZ First Mataroa Paroro
NZ First William Flesher
NZ First John Hall
NZ First Ken Mahon
NZ First Andrew Littlejohn
NZ First Mahesh Bindra
NZ First Susan Sara
NZ First Peter Chan
NZ First Murray Chong
NZ First Joshua Hubbard
NZ First Kym Koloni
NZ First Winston Peters
NZ First Lisa Close
NZ First Romuald Rudzki
NZ First Suzanne Kelly
NZ First Darroch Ball
NZ First Toa Greening
NZ First Denis O'Rourke
NZ First Rob Stevenson
NZ First Talani Meikle
NZ First Tracey Martin
NZ First Geoff Mills
NZ First Fletcher Tabuteau
NZ First Lindy Palmer
NZ First Jenny Marcroft
NZ First Clayton Mitchell
NZ First David Wilson
NZ First Joe Kairau
NZ First Jane Johnston
NZ First Stu Husband
NZ First Richard Prosser
NZ First Ron Mark
NZ First Alexander Familton
NZ First Andy Foster
NZ First Jackie Farrelly
NZ First Reginald Skipworth
NZ First Shane Jones
NZ First Tane Apanui
Opportunities Mika Haka
Opportunities Doug Hill
Opportunities Abe Gray
Opportunities Lindsay Smith
Opportunities Lesley Immink
Opportunities Teresa Moore
Opportunities Donna Pokere-Phillips
Opportunities Richard Warwick
Opportunities Dan Thurston
Opportunities Clint Ulyatt
Opportunities Matt Isbister
Opportunities Piri-Hira Tukapua
Opportunities Olly Wilson
Opportunities Brittany Owens
Opportunities Paddy Plunket
Opportunities Nicky Snoyink
Opportunities Nicola Glenjarman
Opportunities Kevin Neill
Opportunities Geoff Simmons
Outdoors Wilf Bearman-Reidel
Outdoors Derrick Paull
Outdoors David Haynes
Outdoors Alan Simmons
RONZ Jack Gielen
United Future Damian Light
United Future Ian Gaskin
United Future Quentin Todd
United Future John Foster
United Future Kelleigh Sheffield-Cranstoun
United Future John Hubscher
United Future Bale Nadakuitavuki
United Future Peter Dunne
United Future James Maxwell
United Future Sultan Eusoff
United Future Ben Rickard
United Future Bale Nadakuitavuki
"
plst <- read.csv(text=listText, stringsAsFactors = FALSE, sep="\t")
plst$let1st <- sapply(plst$surname, function(x){utf8ToInt(toupper(strsplit(x, split="")[[1]][1]))})
plst %>% filter(party %in% c("ACT" ,
"Green",
"Labour",
"National",
"NZ First",
"Opportunities"
)) %>%
ggplot(aes(x=let1st, y=party, colour=party, fill=party)) + geom_density_ridges(alpha=0.5) +
xlab("electorate candidates by alphabetised surname")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment