Introduction

Analysing the margin of votes by which a candidate wins the election is an important parameter for citizen and even the political parties especially in case of a seat which is decided by low margins. In this section of the analysis, we will explore the variable margin ratio which is calculated as the ratio of margin of votes ( difference in the number of votes between winning candidate and the runner up ) to total valid votes in a constituency.

An example to illustrate how margin ratio works:

Case 1:

Total Votes: 1000 Win Margin: 500 - The winning candidate received 500 more votes than the runner-up Margin Ratio = 500/1000 = 0.5

Case 2:

Total Votes: 1000 Win Margin: 200 Margin Ratio = 200/1000 = 0.2

A lower margin ratio signifies a tight contest whereas a high margin ratio points towards a more one-sided election.

Analysis - How many constituencies had a margin ratio of less than 10%


sessionInfo()
R version 4.0.3 (2020-10-10)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 19043)

Matrix products: default

locale:
[1] LC_COLLATE=English_India.1252  LC_CTYPE=English_India.1252   
[3] LC_MONETARY=English_India.1252 LC_NUMERIC=C                  
[5] LC_TIME=English_India.1252    

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
 [1] kableExtra_1.3.4 knitr_1.33       DT_0.16          scales_1.1.1    
 [5] paletteer_1.4.0  leaflet_2.0.4.1  geojsonsf_2.0.1  sf_1.0-0        
 [9] readxl_1.3.1     forcats_0.5.0    stringr_1.4.0    dplyr_1.0.7     
[13] purrr_0.3.4      readr_1.4.0      tidyr_1.1.2      tibble_3.0.4    
[17] ggplot2_3.3.2    tidyverse_1.3.0  workflowr_1.7.0 

loaded via a namespace (and not attached):
 [1] fs_1.5.0           lubridate_1.7.9.2  webshot_0.5.2      httr_1.4.2        
 [5] rprojroot_2.0.2    tools_4.0.3        backports_1.2.1    bslib_0.2.4       
 [9] utf8_1.1.4         R6_2.5.0           KernSmooth_2.23-17 DBI_1.1.0         
[13] colorspace_2.0-0   withr_2.3.0        tidyselect_1.1.0   processx_3.5.2    
[17] compiler_4.0.3     git2r_0.27.1       cli_3.0.0          rvest_0.3.6       
[21] xml2_1.3.2         prismatic_1.1.0    sass_0.3.1         classInt_0.4-3    
[25] callr_3.7.0        proxy_0.4-26       systemfonts_1.0.1  digest_0.6.27     
[29] rmarkdown_2.9      svglite_2.0.0      pkgconfig_2.0.3    htmltools_0.5.1.1 
[33] dbplyr_2.0.0       htmlwidgets_1.5.2  rlang_0.4.11       rstudioapi_0.13   
[37] farver_2.0.3       jquerylib_0.1.3    generics_0.1.0     jsonlite_1.7.2    
[41] crosstalk_1.1.0.1  magrittr_2.0.1     Rcpp_1.0.7         munsell_0.5.0     
[45] fansi_0.4.1        lifecycle_1.0.0    stringi_1.6.2      whisker_0.4       
[49] yaml_2.2.1         grid_4.0.3         promises_1.2.0.1   crayon_1.4.1      
[53] haven_2.3.1        hms_1.1.0          ps_1.6.0           pillar_1.6.2      
[57] reprex_0.3.0       glue_1.4.2         evaluate_0.14      getPass_0.2-2     
[61] modelr_0.1.8       vctrs_0.3.8        httpuv_1.6.1       cellranger_1.1.0  
[65] gtable_0.3.0       rematch2_2.1.2     assertthat_0.2.1   xfun_0.28         
[69] broom_0.7.9        e1071_1.7-7        later_1.2.0        class_7.3-17      
[73] viridisLite_0.4.0  units_0.7-2        ellipsis_0.3.2