# NOT RUN {
# Reproducing example from Wikipedia
# https://en.wikipedia.org/wiki/Single_transferable_vote#Example
# Uses eps=1
data(food_election)
stv.food <- stv(food_election, mcan = 3, eps = 1)
summary(stv.food)
# }
# NOT RUN {
view(stv.food)
# }
# NOT RUN {
# Example of the IMS Council voting
data(ims_election)
stv.ims <- stv(ims_election, mcan = 5)
# }
# NOT RUN {
view(stv.ims)
# write election results into a csv file
s <- summary(stv.ims)
write.csv(s, "myfile.csv")
# }
# NOT RUN {
# Example of a small committee dataset
# with four candidates (C) and four
# voting committee members (uses tie-breaking)
votes <- data.frame(C1=c(3,2,1,3), C2=c(2,1,2,4),
C3=c(4,3,3,1), C4=c(1,4,4,2))
stv(votes, mcan = 2, verbose = TRUE)
# }
Run the code above in your browser using DataLab