Skip to content

Latest commit

 

History

History
113 lines (85 loc) · 6.09 KB

README.md

File metadata and controls

113 lines (85 loc) · 6.09 KB

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 2014/09/14 25.9 22.7 17.7 7.2 7.2 8.3 5.3 4.8 0.4 3.2 45.4 54.1
Gallup 2014/09/11 22.5 21.7 18.5 9.1 6.2 9.8 6.2 5.2 0.4 0.8 46.8 52.8
Wilke 2014/09/07 24.4 22.4 18.9 8.7 7.2 7.9 4.5 5.0 1.0 2.0 46.2 53.8

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
A, B, F, Ø Parties in left (“red”) coalition. (Provided.) -
Lead Difference between the two biggest parties. (Manually calculated.) -
Red (A+B+F+Ø) Total of party vote share in red coalition. (Provided.) -
Blue (V+O+I+C+K) Total of party vote share in blue coalition. (Provided.) -

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