Skip to content

Commit cc25817

Browse files
committed
Ran devtools
1 parent e977d81 commit cc25817

7 files changed

+55
-19
lines changed

.RData

2.53 KB
Binary file not shown.

NAMESPACE

+1
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,7 @@ export(set_pop_tol)
191191
export(subset_ref)
192192
export(subset_sampled)
193193
export(tally_var)
194+
export(walnuts_blk)
194195
import(redistmetrics)
195196
importFrom(Rcpp,evalCpp)
196197
importFrom(cli,cli_abort)

R/parity.R

+2-3
Original file line numberDiff line numberDiff line change
@@ -151,9 +151,8 @@ min_move_parity <- function(map, plan, counties = NULL, penalty = 0.2) {
151151
#' how much population should be moved from/to each district
152152
#'
153153
#' @examples
154-
#' data(iowa)
155-
#' iowa_map <- redist_map(iowa, existing_plan = cd_2010, pop_tol = 0.01)
156-
#' optimal_transfer(iowa, iowa$cd_2010)
154+
#' map_ar <- alarm_50state_map("AR")
155+
#' optimal_transfer(map_ar, map_ar$cd_2020)
157156
#'
158157
#' @concept analyze
159158
#' @md

man/optimal_transfer.Rd

+2-3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/walnuts_blk.Rd

+36
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/RcppExports.cpp

+7-7
Original file line numberDiff line numberDiff line change
@@ -39,13 +39,13 @@ BEGIN_RCPP
3939
END_RCPP
4040
}
4141
// walnuts_find_boundary_prec
42-
LogicalVector walnuts_find_boundary_prec(List map, IntegerVector plan, int dist_1, int dist_2, int n_rows);
42+
Rcpp::LogicalVector walnuts_find_boundary_prec(Rcpp::List map, Rcpp::IntegerVector plan, int dist_1, int dist_2, int n_rows);
4343
RcppExport SEXP _redist_walnuts_find_boundary_prec(SEXP mapSEXP, SEXP planSEXP, SEXP dist_1SEXP, SEXP dist_2SEXP, SEXP n_rowsSEXP) {
4444
BEGIN_RCPP
4545
Rcpp::RObject rcpp_result_gen;
4646
Rcpp::RNGScope rcpp_rngScope_gen;
47-
Rcpp::traits::input_parameter< List >::type map(mapSEXP);
48-
Rcpp::traits::input_parameter< IntegerVector >::type plan(planSEXP);
47+
Rcpp::traits::input_parameter< Rcpp::List >::type map(mapSEXP);
48+
Rcpp::traits::input_parameter< Rcpp::IntegerVector >::type plan(planSEXP);
4949
Rcpp::traits::input_parameter< int >::type dist_1(dist_1SEXP);
5050
Rcpp::traits::input_parameter< int >::type dist_2(dist_2SEXP);
5151
Rcpp::traits::input_parameter< int >::type n_rows(n_rowsSEXP);
@@ -54,17 +54,17 @@ BEGIN_RCPP
5454
END_RCPP
5555
}
5656
// walnuts_find_boundary_blk
57-
LogicalVector walnuts_find_boundary_blk(List map, IntegerVector plan, int dist_1, int dist_2, int n_rows, CharacterVector geoids, std::string gpp);
57+
Rcpp::LogicalVector walnuts_find_boundary_blk(Rcpp::List map, Rcpp::IntegerVector plan, int dist_1, int dist_2, int n_rows, Rcpp::CharacterVector geoids, std::string gpp);
5858
RcppExport SEXP _redist_walnuts_find_boundary_blk(SEXP mapSEXP, SEXP planSEXP, SEXP dist_1SEXP, SEXP dist_2SEXP, SEXP n_rowsSEXP, SEXP geoidsSEXP, SEXP gppSEXP) {
5959
BEGIN_RCPP
6060
Rcpp::RObject rcpp_result_gen;
6161
Rcpp::RNGScope rcpp_rngScope_gen;
62-
Rcpp::traits::input_parameter< List >::type map(mapSEXP);
63-
Rcpp::traits::input_parameter< IntegerVector >::type plan(planSEXP);
62+
Rcpp::traits::input_parameter< Rcpp::List >::type map(mapSEXP);
63+
Rcpp::traits::input_parameter< Rcpp::IntegerVector >::type plan(planSEXP);
6464
Rcpp::traits::input_parameter< int >::type dist_1(dist_1SEXP);
6565
Rcpp::traits::input_parameter< int >::type dist_2(dist_2SEXP);
6666
Rcpp::traits::input_parameter< int >::type n_rows(n_rowsSEXP);
67-
Rcpp::traits::input_parameter< CharacterVector >::type geoids(geoidsSEXP);
67+
Rcpp::traits::input_parameter< Rcpp::CharacterVector >::type geoids(geoidsSEXP);
6868
Rcpp::traits::input_parameter< std::string >::type gpp(gppSEXP);
6969
rcpp_result_gen = Rcpp::wrap(walnuts_find_boundary_blk(map, plan, dist_1, dist_2, n_rows, geoids, gpp));
7070
return rcpp_result_gen;

src/boundary.cpp

+7-6
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
1+
#include <RcppArmadillo.h>
12

23
// Given a map and a plan, find precincts in dist_1 that border dist_2
34

45
// [[Rcpp::export]]
5-
LogicalVector walnuts_find_boundary_prec(List map, IntegerVector plan, int dist_1, int dist_2, int n_rows) {
6-
LogicalVector boundary(n_rows, false);
6+
Rcpp::LogicalVector walnuts_find_boundary_prec(Rcpp::List map, Rcpp::IntegerVector plan, int dist_1, int dist_2, int n_rows) {
7+
Rcpp::LogicalVector boundary(n_rows, false);
78

89
for (int i = 0; i < n_rows; i++) {
9-
IntegerVector adj = map[i];
10+
Rcpp::IntegerVector adj = map[i];
1011
int adj_length = adj.size();
1112
if (plan[i] == dist_1) {
1213
for (int j = 0; j < adj_length; j++) {
@@ -24,11 +25,11 @@ LogicalVector walnuts_find_boundary_prec(List map, IntegerVector plan, int dist_
2425
// Given a map and a plan, find precincts in dist_1 that border dist_2 that are in the gpp
2526

2627
// [[Rcpp::export]]
27-
LogicalVector walnuts_find_boundary_blk(List map, IntegerVector plan, int dist_1, int dist_2, int n_rows, CharacterVector geoids, std::string gpp) {
28-
LogicalVector boundary(n_rows, false);
28+
Rcpp::LogicalVector walnuts_find_boundary_blk(Rcpp::List map, Rcpp::IntegerVector plan, int dist_1, int dist_2, int n_rows, Rcpp::CharacterVector geoids, std::string gpp) {
29+
Rcpp::LogicalVector boundary(n_rows, false);
2930

3031
for (int i = 0; i < n_rows; i++) {
31-
IntegerVector adj = map[i];
32+
Rcpp::IntegerVector adj = map[i];
3233
int adj_length = adj.size();
3334
if (as<std::string>(geoids[i]) == gpp && plan[i] == dist_1) {
3435
for (int j = 0; j < adj_length; j++) {

0 commit comments

Comments
 (0)