votes <- sample(1:10000, 5)
parties <- sample(letters, 5)
dHondt(parties, votes, 5 )
# Example: 2014 Brazilian election for the lower house in the state of Ceara.
# Coalitions leading by the following parties:
results <- c(DEM=490205, PMDB=1151547, PRB=2449440,
PSB=48274, PSTU=54403, PTC=173151)
dHondt(parties=names(results), votes=results, 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