R script to calculate political power indices