# How can we obtain voting data after the election?

Will we be able to see the results by vote after the elections are over? Or will we just have an announcement of who the winners are? I would be interested in knowing the exact numbers, as in:

Candidate 1: x # of votes

Candidate 2: x # of votes

etc.

• It's almost over! Who will win? When will winners be notified? Oct 1, 2013 at 19:55

Yes. You can even practice now on the results of our first election held in 2011: find them at https://stats.stackexchange.com/election/1. (For some inspiration, check out what another site has done with their election results.)

As an example, here is R code to read and process an election file from a sister site's election (GIS in 2013). (I chose this because my familiarity with the details enabled me to verify the code is processing the data correctly.) It also tabulates the votes as shown in this barplot:

(Candidates are ordered by a heuristic likely to correspond to the outcome of the election.)

source <- "http://gis.stackexchange.com/election/download-result/2"
#
# Read and process the election descriptor record
n.candidates <- v[1]
n.positions <- v[2]
#
# Read the rest of the file
#
# Process the candidate descriptor record
candidates <- x[j <- is.na(x[,2]), 1]
na.candidate <- candidates[1]
candidates <- candidates[c(-1,-length(candidates))]
#
# Process the voting record
sapply(z, function(i) ifelse(i==0, NA, candidates[i]))))
rownames(d) <- c("First", "Second", "Third")
#
# Tabulate the raw results found in array d
results <- apply(d, 1, table, useNA="always")
rownames(results) <- c(levels(candidates)[sort(candidates)], "NA")
i <- order(results %*% c(5,3,1), decreasing=TRUE)
results[i, ] # Prints the two-way table of candidate by position
#
# Plot the tabulated results
barplot(t(results[i,]), legend.text=colnames(results), main=source)

• The plot of the evolution of the votes over time was super cool :)
– user25658
Sep 24, 2013 at 5:34
• I have just learned this code doesn't process the missing votes in the way intended by the STV software. The code here takes them as-is; for instance, if someone voted for a second and third place, that's what it uses. Apparently the official method first promotes those votes into votes for a first and second place before it proceeds. I'm not going to bother fixing this because the point was to document the raw results, never to reproduce the Meek STV calculation: but just be aware that there will likely be minor discrepancies in tallies compared to other vote summaries.
– whuber Mod
Oct 1, 2013 at 20:38