Skip to content

Commit

Permalink
version 1.5.0
Browse files Browse the repository at this point in the history
  • Loading branch information
polettif authored and cran-robot committed Apr 4, 2024
1 parent cbd09dc commit c6730f9
Show file tree
Hide file tree
Showing 59 changed files with 6,361 additions and 5,734 deletions.
6 changes: 3 additions & 3 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Package: proporz
Type: Package
Title: Proportional Apportionment
Version: 1.4.0
Version: 1.5.0
Authors@R: c(
person("Flavio", "Poletti", role = c("aut", "cre", "cph"), email = "flavio.poletti@hotmail.ch"))
Description: Calculate seat apportionment for legislative bodies with
Expand All @@ -20,8 +20,8 @@ URL: https://github.com/polettif/proporz
BugReports: https://github.com/polettif/proporz/issues
VignetteBuilder: knitr
NeedsCompilation: no
Packaged: 2024-03-01 06:18:17 UTC; flavi
Packaged: 2024-04-03 16:00:49 UTC; flaviopoletti
Author: Flavio Poletti [aut, cre, cph]
Maintainer: Flavio Poletti <flavio.poletti@hotmail.ch>
Repository: CRAN
Date/Publication: 2024-03-04 10:30:02 UTC
Date/Publication: 2024-04-03 16:50:02 UTC
108 changes: 57 additions & 51 deletions MD5
Original file line number Diff line number Diff line change
@@ -1,56 +1,62 @@
42847b73f7556e34c9bdc12ae00a230b *DESCRIPTION
7c42308b3c6d83e356959179a50009c8 *NAMESPACE
37fb1a0d16de03a0adaef8a96dc34a9a *NEWS.md
19f124e75acf29920496805f96a19a41 *R/S3.R
07677b5cb0c53fdf533e620ff0896354 *R/biproportional-check.R
24bc1be83409739df9f72710b50ccc56 *R/biproportional.R
2355f31ef7e3d41fdc98f6a0d957b50f *R/data.R
09afeeaa94f57cbc832fae5192b1b842 *R/divisor-check.R
77e4c9a657a038b5e06be72862b49935 *R/divisor.R
12afcf5098722c68be3f07408868d91b *R/proporz.R
d47e872fd02fcb9d5cc07e565d2d52da *R/quorum.R
df248c1a76201e986c7979c69db936af *R/quota.R
f504e4a1534ee9cbe0d882a1570f4306 *R/round.R
e5b7e12bc7defd9bfa73f92d43f1f2c2 *R/shinyapp.R
fc5becccd9ea49fe7b9762ddbe707835 *R/sysdata.rda
ffb71b72440e19af475c3808f65f78cd *R/utils.R
7ee52eac4f9e1a1ac40609dd9c003514 *README.md
346d403f86c26ebed29e07a0b01edd68 *build/vignette.rds
e826b13b45ead083c107228b8a01a0b9 *DESCRIPTION
795e791e9f2bc16a90711c61ad476376 *NAMESPACE
7e0aa60963432d4ba9dec8b668f5ae02 *NEWS.md
1cc04f8d0681ab23456742addb60a41e *R/S3.R
66fae1a1f6d1f245584c83788f2634fc *R/biproportional-check.R
d8d255fc0e62af31f9f7996a252d2332 *R/biproportional-divisors.R
8e3a1890ea07701d66088cc559765774 *R/biproportional-wto.R
643a1f41fca8c5e63011bd1b8cec8784 *R/biproportional.R
5b7c34e0ab59dd13afddf0e316071eb0 *R/data.R
16b902e07fadcb39a8e45976b1c1afeb *R/divisor-check.R
0fb0a13023ceb787842abe4e8b3fb7ba *R/divisor.R
d8cfa64febd7fdbd59e297a3ba43ebe5 *R/proporz.R
0131b1b67ed9121703f14759189cd22d *R/quorum.R
98c573b5f1eb471b74bfa7ff5744588f *R/quota.R
5190e8107f708679574c67ed815a4df5 *R/round.R
a4baa0119c269f4d2026d5e961030686 *R/shinyapp.R
3211e751c6b6a0fb4325c32a09dfc837 *R/sysdata.rda
915548b348c6115fa34b8261b8cd714f *R/utils.R
d99ad0266eff3019240cff488cfcaa3b *README.md
e56c7c0bc5aa6637dc7a0091a1281c3a *build/vignette.rds
b8825109a052d855a5ddfad865ac0e72 *data/finland2019.rda
e0ce670dd5cef250a03f47d920ad5131 *data/uri2020.rda
8f529e67bde1cdcf0d974483e884d6f1 *data/zug2018.rda
3f27e6b10f86a5c5186be5fdc59b5645 *inst/doc/apportionment_scenarios.R
990fe4323647e414a0617b7674130acc *inst/doc/apportionment_scenarios.Rmd
8d6ec86ad44863d99a65e620e226d974 *inst/doc/apportionment_scenarios.html
3b56b2f45ef22864cc83514d2b6e616b *man/biproporz.Rd
d3c6fb839f9cfe7c891a613105a17671 *man/ceil_at.Rd
cbae8eca45fefb09aa62a9d9c17f2808 *man/divisor_methods.Rd
4e7eb17806a04e04ac58d65259d508a7 *inst/doc/apportionment_scenarios.R
78aed4a060ea4910ffbe2705d8fb01ea *inst/doc/apportionment_scenarios.Rmd
ad07b583e6f9267ce8fafa583a0f022d *inst/doc/apportionment_scenarios.html
93e3a00518d5d0365690e03a7188a8b7 *man/biproporz.Rd
2d1cdb8e9487a5658378fdf3548a6a3e *man/ceil_at.Rd
db3cdfcdf45bfe6bc6e60e9aae56ef2e *man/divide_votes_matrix.Rd
668fee8b5c72db227a7b63b665858d7e *man/divisor_methods.Rd
1d57e990fddc3bf8cb1a70e2041fbf8b *man/figures/logo.png
a3709ad2c73fce86f7aa4d8aee9f8e70 *man/figures/shinyapp-example.gif
4de3c4d85b547c483140ab2f0f5d4a06 *man/finland2019.Rd
d4dcb85cc011891f19d6bc0bb54fa461 *man/get_divisors.Rd
bbe38decbaf22328bac4fa2f5195fa53 *man/highest_averages_method.Rd
88196e3a587dfeec004fa1510e29a710 *man/largest_remainder_method.Rd
7aad0ed36a6f99e8aadf9a3369baa232 *man/lower_apportionment.Rd
74553b441ed81a5d5cf699ef08bed7fe *man/pivot_to_matrix.Rd
99795c3836b923f24f13a2f219e9a670 *man/proporz.Rd
0248b3f131f9ee0d392ca18da82fbc09 *man/proporz_methods.Rd
fabee1dc05943057556dfca33bdd8670 *man/pukelsheim.Rd
59190a89f31231eea464014767cada57 *man/quorum_functions.Rd
235d349ab4df595fb6e9fe3d283f309f *man/reached_quorum_any_district.Rd
6cff10f26cec3f04d5ccbc580346cf79 *man/reached_quorum_total.Rd
04550fa94087f3a8edef9edfeb6be47b *man/reached_quorums.Rd
0763757b636eab5243ebf829ef30628d *man/run_app.Rd
bb8b0ee812d65bd812e680078933e747 *man/upper_apportionment.Rd
1fec3b8b8a940397b1695a0fa7757427 *man/uri2020.Rd
c31965e383004d872d30979289befa71 *man/weight_list_votes.Rd
3be7288a700d6646e2c3f4b12e30bbcf *man/zug2018.Rd
474733edde6b96b0560c90f4a0f680a5 *tests/testthat.R
29902139ad35c17e65d3e544c82051ac *tests/testthat/test-biproportional.R
14b35f35ea752972f281b4ff04df0609 *tests/testthat/test-divisor.R
352ff0089b7627978516cf25e0b3ce06 *tests/testthat/test-proporz.R
3d601afc0ff2e2c357e8a8dfb4bdb849 *tests/testthat/test-quota.R
a422e21f7a279e84e54ba43051b53f6f *tests/testthat/test-round.R
da360eda4f04be19c7dc6ce671a58a90 *tests/testthat/test-utils.R
b1a9e00cc88e8d7c7f769e6b531536ed *tests/testthat/test-zug2018.R
990fe4323647e414a0617b7674130acc *vignettes/apportionment_scenarios.Rmd
67cfe39bbf0f3fe437091b73ed1fe6ce *man/find_divisor.Rd
86ee3f238283e6f93ce3072db3129778 *man/find_matrix_divisors.Rd
87f37009fe9f2634abf0656ec3952b4c *man/finland2019.Rd
5c136501c347870e613c7517f4e8102c *man/get_divisors.Rd
fe4b5010dc98824337ea9790ac627f49 *man/highest_averages_method.Rd
804ed4a5a93c38d3e3abe5a5d3368b9e *man/largest_remainder_method.Rd
b9f67c1e202881b6afa3d9521159da0c *man/lower_apportionment.Rd
060dbef4a3ed1e92888780e5a59de637 *man/pivot_to_matrix.Rd
b01040ac3fff937bc86728f9c751667a *man/proporz.Rd
01a13db45c84192adebc6d6d4eaa2fe0 *man/proporz_methods.Rd
75e30c663a08f7fd4e0e948dc1d53c20 *man/pukelsheim.Rd
4cfc56716757242ccada41cae7e0e903 *man/quorum_functions.Rd
6fffdaf1998968045ccbeda881296848 *man/reached_quorum_any_district.Rd
77a409d4137eba6eff12f59e9e679c0b *man/reached_quorum_total.Rd
2a3459b554c8b0fb665fa05067089ce9 *man/reached_quorums.Rd
fa234d71c518754574135415cb9af018 *man/run_app.Rd
6642aea9934d7a71a3046237b3f28e81 *man/upper_apportionment.Rd
4423e2f0a47d37defcc09f3487a9586e *man/uri2020.Rd
35b4da1a5b0379be9fe3bab7dd59468b *man/weight_list_votes.Rd
1fc37e403fd004ff6ce6e148bdc493d5 *man/zug2018.Rd
7a87c3caa4be8086b07bca40e12d8e73 *tests/testthat.R
8c6db201fddfd170657bff60b7e5332d *tests/testthat/test-biproportional-data.R
8bbcad10d534c532485f30826d99bc64 *tests/testthat/test-biproportional-wto.R
bc354e9c0d53ac04b99318fe34c25422 *tests/testthat/test-biproportional.R
5569821ae6d481920de73d1ad602870a *tests/testthat/test-divisor.R
a482ab7e4eebea8370e7930f5f1b43da *tests/testthat/test-proporz.R
4943093f1eb8f9647f84e54be43732b1 *tests/testthat/test-quota.R
07a152922d54c59be2aa9ee8c0ece191 *tests/testthat/test-round.R
bf719d4697e3bc0807d0c6f01d4037e5 *tests/testthat/test-utils.R
78aed4a060ea4910ffbe2705d8fb01ea *vignettes/apportionment_scenarios.Rmd
54 changes: 27 additions & 27 deletions NAMESPACE
Original file line number Diff line number Diff line change
@@ -1,27 +1,27 @@
# Generated by roxygen2: do not edit by hand
S3method(as.matrix,proporz_matrix)
S3method(print,proporz_matrix)
export(biproporz)
export(ceil_at)
export(divisor_ceiling)
export(divisor_floor)
export(divisor_geometric)
export(divisor_harmonic)
export(divisor_round)
export(get_divisors)
export(highest_averages_method)
export(largest_remainder_method)
export(lower_apportionment)
export(pivot_to_df)
export(pivot_to_matrix)
export(proporz)
export(pukelsheim)
export(quorum_all)
export(quorum_any)
export(reached_quorum_any_district)
export(reached_quorum_total)
export(run_app)
export(upper_apportionment)
export(weight_list_votes)
importFrom(stats,setNames)
# Generated by roxygen2: do not edit by hand

S3method(as.matrix,proporz_matrix)
S3method(print,proporz_matrix)
export(biproporz)
export(ceil_at)
export(divisor_ceiling)
export(divisor_floor)
export(divisor_geometric)
export(divisor_harmonic)
export(divisor_round)
export(get_divisors)
export(highest_averages_method)
export(largest_remainder_method)
export(lower_apportionment)
export(pivot_to_df)
export(pivot_to_matrix)
export(proporz)
export(pukelsheim)
export(quorum_all)
export(quorum_any)
export(reached_quorum_any_district)
export(reached_quorum_total)
export(run_app)
export(upper_apportionment)
export(weight_list_votes)
importFrom(stats,setNames)
90 changes: 49 additions & 41 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,41 +1,49 @@
# proporz 1.4.0

* first CRAN release
* add vignette and examples
* removed `biproportional()`, only use `biproporz()`
* renamed `quota_largest_remainder()` to `largest_remainder_method()`
* renamed `divisors()` to `get_divisors()`
* removed `hzv()` alias and made `reached_quorums()` internal
* update documentation and tests
* minor bugfixes

# proporz 1.3.1

* error if not enough seats are available for harmonic/geometric divisor methods
* always error on equal remainders

# proporz 1.3.0

* rework and expand quorum calculations (#4)
* deprecated quorum_total and quorum_districts parameters

# proporz 1.2.1

* allow number of seats to be 0 instead of throwing error

# proporz 1.2.0

* throw error if no solution can be found
* added basic shiny app

# proporz 1.1.0

* apportion method and use_list_votes parameter for biproportional()
* add finland2019 dataset
* export lower and upper apportionment functions
* improve divisor search

# proporz 1.0.0

* Publish package to Github

# proporz 1.5.0

* add new feature: winner take one method for `biproporz()` and `pukelsheim` (#10)
* allow non-integer vote counts
* round divisors to as few digits as possible
* changed error message for undefined/tied results
* fixed bugs and added more real data tests

# proporz 1.4.0

* first CRAN release
* add vignette and examples
* removed `biproportional()`, only use `biproporz()`
* renamed `quota_largest_remainder()` to `largest_remainder_method()`
* renamed `divisors()` to `get_divisors()`
* removed `hzv()` alias and made `reached_quorums()` internal
* update documentation and tests
* minor bugfixes

# proporz 1.3.1

* error if not enough seats are available for harmonic/geometric divisor methods
* always error on equal remainders

# proporz 1.3.0

* rework and expand quorum calculations (#4)
* deprecated quorum_total and quorum_districts parameters

# proporz 1.2.1

* allow number of seats to be 0 instead of throwing error

# proporz 1.2.0

* throw error if no solution can be found
* added basic shiny app

# proporz 1.1.0

* apportion method and use_list_votes parameter for biproportional()
* add finland2019 dataset
* export lower and upper apportionment functions
* improve divisor search

# proporz 1.0.0

* Publish package to Github

43 changes: 12 additions & 31 deletions R/S3.R
Original file line number Diff line number Diff line change
@@ -1,31 +1,12 @@
#' @export
print.proporz_matrix = function(x, ...) {
y <- as.matrix(x)
print(y)
invisible(x)
}

#' @export
as.matrix.proporz_matrix = function(x, ...) {
matrix(x, nrow = nrow(x), dimnames = dimnames(x))
}

#' Get district and party divisors from biproporz result
#'
#' Show the district and party divisors used to assign seats.
#' This method provides easier access to divisors stored in
#' `attributes(...)$divisors`
#'
#' @param biproporz_result a matrix created by [biproporz()]
#' or a data.frame created by [pukelsheim()]
#'
#' @returns The district and party divisors in a list, each as a vector
#'
#' @examples
#' seats_matrix = biproporz(uri2020$votes_matrix, uri2020$seats_vector)
#' get_divisors(seats_matrix)
#'
#' @export
get_divisors = function(biproporz_result) {
attributes(biproporz_result)$divisors
}
#' @export
print.proporz_matrix = function(x, ...) {
y <- as.matrix(x)
print(y)
invisible(x)
}

#' @export
as.matrix.proporz_matrix = function(x, ...) {
matrix(x, nrow = nrow(x), dimnames = dimnames(x))
}

0 comments on commit c6730f9

Please sign in to comment.