Learn R Programming

proporz (version 1.5.3)

weight_votes_matrix: Create weighted votes matrix

Description

Weight votes by dividing the votes matrix entries by the number of seats per district. Votes in districts without seats are set to zero.

Usage

weight_votes_matrix(votes_matrix, district_seats)

weight_list_votes(votes_matrix, district_seats)

Value

The weighted votes_matrix with the number of voters (not rounded).

Arguments

votes_matrix

Votes matrix

district_seats

Seats per district, vector with same length as ncol(votes_matrix) and names as colnames(votes_matrix)

See Also

This method is used in upper_apportionment() if weight_votes is TRUE (default).

Examples

Run this code
(vm <- matrix(c(20, 10, 8, 5), nrow = 2))
weight_votes_matrix(vm, c(3, 2))

weight_votes_matrix(uri2020$votes_matrix, uri2020$seats_vector)

Run the code above in your browser using DataLab