votes <- sample(1:10000, 5)
dHondt(letters[1:5], votes, 5 )
#Example: 2014 Brazilian election for the lower house in the state of Ceara:
votes <- c(490205, 1151547, 2449440, 48274, 54403, 173151)
# Coalitions leading by the following parties:
parties <- c("DEM","PMDB","PRB","PSB", "PSTU","PTC")
dHondt(parties, votes, seats=19)
# The next example is for the state legislative house of Ceara:
votes <- c(187906, 326841,132531, 981096, 2043217,15061,103679,109830, 213988, 67145, 278267)
parties <- c("PC do B", "PDT","PEN", "PMDB", "PRB","PSB","PSC", "PSTU", "PT do B", "PTC", "PTN")
dHondt(parties, votes , 42)
Run the code above in your browser using DataLab