A collection of Danish opinion polls
HTML
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
_tests
election2011
.travis.yml
INCONSISTENCIES.md
LICENSE.md
README.md
all-polls.csv
chart.png
data.csv

README.md

Danish Polls

Build Status MIT-license badge Download link

Opinion-poll chart

Updating the data on the relevant wiki is becoming a royal pain, so I might as well update the polling data here, in a CSV file. This will also speed up the process of updating interactive graphics reliant on the data.

  • View and inspect the data here.
  • Download the project as a compressed file here.
  • Get the raw CSV here.

More polls can be found using this collection of polls.

Because manually entering data inevitably results in human errors, I have created a basic test script that detects inconsistencies in how the individual values match calculations based on those figures. The findings of this script that have not been addressed are available in the INCONSISTENCIES.md file, available here.

Understanding the Data

Table Excerpt

Polling Firm Date V A O B F Ø I C K Å  Lead Red (A+B+F+Ø+Å) Blue (V+O+I+C+K)
Voxmeter 2015-03-01 22.3 23.1 19.6 7.8 6.9 8.5 4.8 5.3 0.3 1.2 0.8 47.5 52.3
Epinion 2015-02-23 23.7 22.0 21.7 6.3 6.3 8.9 5.7 4.9 0.7 - 1.7 43.5 56.7
Voxmeter 2015-02-22 23.5 23.7 18.3 7.7 7.1 8.8 6.1 4.2 0.3 - 0.2 47.3 52.4

Table Legend

Column(s) Description Value Type
Polling Firm Firm behind the opinion poll. Text
Date Date of opinion poll. Date: YYYY-MM-DD/%Y-%m-%d/ISO 8601
V, O, I, C, K Parties in right (“blue”) coalition. (Provided.) Per cent, 0.0–100.0, or -
A, B, F, Ø, Å Parties in left (“red”) coalition. (Provided.) Per cent, 0.0–100.0, or -
Lead Difference between the two biggest parties. (Manually calculated.) Per cent: 0.0–100.0
Red (A+B+F+Ø+Å) Total of party vote share in red coalition. (Provided.) Per cent: 0.0–100.0
Blue (V+O+I+C+K) Total of party vote share in blue coalition. (Provided.) Per cent: 0.0–100.0

Sometimes, the Red/Blue coalition figure is not provided. In that case, I calculate the figure it myself. Some of the provided coalition figures tend to be different than the sum of their parties, because the pollster factor in the parties failing to meet the voting threshold of 2%. I prefer to leave such post-processing outside the scope of the dataset myself for dynamic tools like D3 to compute.

Displaying the Data with D3

I am still trying to figure out how to plot a LOESS trendline in JavaScript with science.js to finish up my Party Trend chart, so any help towards achieving that would be appreciated immensely.

You can see the status of the fancy chart at the top of this project page.

Additional Polling Data

all-polls.csv

Polling companies like YouGov do some dreadful polling, but some people still want to use their data towards their own ends. Because of this, I have included the YouGov data in the file called all-polls.csv.

You convert all-polls.csv to data.csv with

$ grep -v YouGov all-polls.csv > data.csv

And, if needed, you can sort it with

$ sort -r -n -t"," -k2.4 -k2.6 -k2.7 -k2.9 -k2.10 all-polls.csv > sorted.csv
# And move the header back to the top afterwards

You can probably get away with a general CSV sort, since the date format conforms to the ISO 8601 standard:

$ sort -t"," -r -k2 all-polls.csv > sorted.csv

2011-Election Data

To find out more, go to its folder.

Getting Opinion-Polling Data from Wikis

You can retrieve some Danish opinion-polling data from the wiki—as well as data from other countries. To achieve this, you can use Google Docs. For more on how I did that, see this guide.

That guide does not mention how to clean the sorry raw data you get in Google Spreadsheets, so here are the steps for cleaning the data, after you’ve saved it as, say, a CSV file.

Cleaning Spreadsheet Data

  1. Remove header separator (,,,).
  2. Put all headers on one line.
  3. Remove all footnotes ([1], [2], etc.).
  4. Fix the non-2014 year dates shown as 2014.
  5. Remove all year separator lines (2014,,,).
  6. Remove the line with the EP election.
  7. (Optional: Remove all YouGov polls.)

To-Do List

Visit the project’s issue tracker to follow its status and development. There is still much to be done.

Sibling Projects