diff --git a/.Rbuildignore b/.Rbuildignore index 480566ae..fe3faf4b 100644 --- a/.Rbuildignore +++ b/.Rbuildignore @@ -9,3 +9,4 @@ ^R/ei_sim\.R$ ^CODE_OF_CONDUCT\.md$ ^CONTRIBUTING\.md$ +^cran-comments\.md$ diff --git a/NAMESPACE b/NAMESPACE index 9262240b..55daee2b 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -116,7 +116,6 @@ importFrom(stats,na.omit) importFrom(stats,quantile) importFrom(stats,sd) importFrom(stats,setNames) -importFrom(stats,weighted.mean) importFrom(stringr,str_c) importFrom(stringr,str_count) importFrom(stringr,str_detect) diff --git a/R/data.R b/R/data.R index 0d04a520..f9690e88 100644 --- a/R/data.R +++ b/R/data.R @@ -65,45 +65,6 @@ #' @source East Ramapo School District "ersd_maps" - -#' Los Angeles County 2010 Election Results -#' -#' This dataset contains precinct vote data and racial demographics from a 2010 -#' election in Los Angeles County. -#' -#' @name lac_10 -#' @format A data frame with 4980 observations on the following 10 variables: -#' \describe{ -#' \item{precinct}{Precinct ID number.} -#' \item{tot_reg}{The total number of registered voters.} -#' \item{i_jones}{Number of votes for Jones.} -#' \item{i_delatore}{Number of votes for Delatorre.} -#' \item{votescast}{The total number of votes cast.} -#' \item{lat_voters}{Number of Latino voters.} -#' \item{pct_latino}{Percent of voters identifying as Latino.} -#' \item{pct_delatorre}{Percent of vote for Delatorre.} -#' \item{pct_jones}{Percent of vote for Jones.} -#' \item{pct_other}{Percent of vote for other candidates.} -#' } -#' @usage data(lac_10) -#' @source Los Angeles County -"lac_10" - - -#' New York State FIPS codes -#' -#' New York State FIPS codes for 500 voters. -#' -#' @name ny_fips -#' @format A data frame with 500 observations on the following 2 variables: -#' \describe{ -#' \item{row_id}{Unique identifier.} -#' \item{FIP}{The 15-digit FIPS code.} -#' } -#' @usage data(ny_fips) -"ny_fips" - - #' New York Voter File Sample #' #' This dataset contains a sample of 500 voters in East Ramapo School District, diff --git a/R/ei_homog.R b/R/ei_homog.R index db93782d..49514b88 100644 --- a/R/ei_homog.R +++ b/R/ei_homog.R @@ -11,11 +11,12 @@ #' @param race_cols A character vector listing the column names for turnout by race #' @param totals_col The name of the column containing total votes cast in each precinct #' @param cp numeric; homogeneous precinct cut-point, e.g., 0.80; default = 0.80 -#' @warn_row = numeric; threshold number of precincts racial group must be above to +#' @param warn_row numeric; threshold number of precincts racial group must be above to #' conduct analysis; default = 5. For example, with three groups, whites, blacks, Hispanics, #' each group must have at least 5 precincts with at least 80% share of the population for #' that group. All racial groups need to have at least n number of precincts at or above #' warn_row level or error will be thrown. +#' @param verbose flag indicating whether to print status messages #' @return matrix with homogeneous precinct results, columns = race groups, rows = candidates #' @author Loren Collingwood ; #' @author Stephen Popick diff --git a/R/map_interactive.R b/R/map_interactive.R index 2249f0aa..d12c2f19 100644 --- a/R/map_interactive.R +++ b/R/map_interactive.R @@ -51,7 +51,7 @@ map_interactive <- function(voter_file, } - map_inter <- leaflet(data = voter_file) %>% + map_inter <- leaflet::leaflet(data = voter_file) %>% addTiles() %>% addMarkers(~lat, ~lon, popup = paste( diff --git a/cran-comments.md b/cran-comments.md new file mode 100644 index 00000000..c185b2cd --- /dev/null +++ b/cran-comments.md @@ -0,0 +1,18 @@ +## R CMD check results + +## Test environments +* local OS X install, R 4.0.2 +* ubuntu 18.04 (on travis-ci), R 4.0.2 + +## R CMD check results +There were no ERRORs or WARNINGs. + +There were 2 NOTES: + +* NOTE installed size is 5.7Mb sub-directories of 1Mb or more: doc 4.7Mb + + As described in the .readme, the package is built to facilitate work by users with many different levels of programming experience. This requires detailed, extensive documentation. + +* checking for future file timestamps ... NOTE unable to verify current time + + As indicated [here](https://stackoverflow.com/questions/63613301/r-cmd-check-note-unable-to-verify-current-time) this appears to be an issue within `r-cmd-check` diff --git a/data/lac_10.rda b/data/lac_10.rda deleted file mode 100644 index e7f1969e..00000000 Binary files a/data/lac_10.rda and /dev/null differ diff --git a/data/ny_fips.rda b/data/ny_fips.rda deleted file mode 100644 index faad187c..00000000 Binary files a/data/ny_fips.rda and /dev/null differ diff --git a/man/ei_homog.Rd b/man/ei_homog.Rd index cffaed89..9676339e 100644 --- a/man/ei_homog.Rd +++ b/man/ei_homog.Rd @@ -27,11 +27,11 @@ ei_homog( \item{warn_row}{numeric; threshold number of precincts racial group must be above to conduct analysis; default = 5. For example, with three groups, whites, blacks, Hispanics, -each group must have at least 5 precincts with at least 80\% share of the population for +each group must have at least 5 precincts with at least 80% share of the population for that group. All racial groups need to have at least n number of precincts at or above warn_row level or error will be thrown.} -\item{verbose}{A boolean indicating whether to print out status messages.} +\item{verbose}{flag indicating whether to print status messages} } \value{ matrix with homogeneous precinct results, columns = race groups, rows = candidates @@ -39,7 +39,7 @@ matrix with homogeneous precinct results, columns = race groups, rows = candidat \description{ Creates matrix table of homogeneous precinct analysis results by racial/ethnic group. The idea, for example, is to get a basic sense of voting behavior by racial group, examine candidate -preference in districts that are above 80\% white, 80\% black, etc. +preference in districts that are above 80% white, 80% black, etc. } \details{ ei_homog diff --git a/man/lac_10.Rd b/man/lac_10.Rd deleted file mode 100644 index dcfd5f74..00000000 --- a/man/lac_10.Rd +++ /dev/null @@ -1,32 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/data.R -\docType{data} -\name{lac_10} -\alias{lac_10} -\title{Los Angeles County 2010 Election Results} -\format{ -A data frame with 4980 observations on the following 10 variables: -\describe{ - \item{precinct}{Precinct ID number.} - \item{tot_reg}{The total number of registered voters.} - \item{i_jones}{Number of votes for Jones.} - \item{i_delatore}{Number of votes for Delatorre.} - \item{votescast}{The total number of votes cast.} - \item{lat_voters}{Number of Latino voters.} - \item{pct_latino}{Percent of voters identifying as Latino.} - \item{pct_delatorre}{Percent of vote for Delatorre.} - \item{pct_jones}{Percent of vote for Jones.} - \item{pct_other}{Percent of vote for other candidates.} -} -} -\source{ -Los Angeles County -} -\usage{ -data(lac_10) -} -\description{ -This dataset contains precinct vote data and racial demographics from a 2010 -election in Los Angeles County. -} -\keyword{datasets} diff --git a/man/ny_fips.Rd b/man/ny_fips.Rd deleted file mode 100644 index 3fa33362..00000000 --- a/man/ny_fips.Rd +++ /dev/null @@ -1,20 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/data.R -\docType{data} -\name{ny_fips} -\alias{ny_fips} -\title{New York State FIPS codes} -\format{ -A data frame with 500 observations on the following 2 variables: -\describe{ - \item{row_id}{Unique identifier.} - \item{FIP}{The 15-digit FIPS code.} -} -} -\usage{ -data(ny_fips) -} -\description{ -New York State FIPS codes for 500 voters. -} -\keyword{datasets} diff --git a/vignettes/fulton_gwinnett_shape_maps.PNG b/vignettes/fulton_gwinnett_shape_maps.PNG deleted file mode 100644 index 1b2ab03c..00000000 Binary files a/vignettes/fulton_gwinnett_shape_maps.PNG and /dev/null differ diff --git a/vignettes/gelman.png b/vignettes/gelman.png deleted file mode 100644 index 20ae4653..00000000 Binary files a/vignettes/gelman.png and /dev/null differ diff --git a/vignettes/geo_combined_map_interactive_small.PNG b/vignettes/geo_combined_map_interactive_small.PNG deleted file mode 100644 index 7eba5da8..00000000 Binary files a/vignettes/geo_combined_map_interactive_small.PNG and /dev/null differ diff --git a/vignettes/geo_combined_map_points_voters.PNG b/vignettes/geo_combined_map_points_voters.PNG deleted file mode 100644 index 6a8bb2a4..00000000 Binary files a/vignettes/geo_combined_map_points_voters.PNG and /dev/null differ diff --git a/vignettes/geocoding.Rmd b/vignettes/geocoding.Rmd index 1033117d..ab06bf66 100644 --- a/vignettes/geocoding.Rmd +++ b/vignettes/geocoding.Rmd @@ -28,7 +28,6 @@ Each library/package loaded allows you to use certain functions needed to prep y ```{r setup, results='hide', message=FALSE} library(eiCompare) library(stringr) -library(plyr) library(dplyr) library(tidyr) library(foreach) @@ -145,10 +144,6 @@ voter_data <- concat_final_address( voter_data <- as_tibble(voter_data) ``` -```{r, echo=FALSE} -knitr::include_graphics("voter_data_df.PNG") -``` - ### Step 3: run_geocoder() Function #### Select a geocoder and run the geocoder on the addresses in your file. @@ -335,7 +330,7 @@ We will map the area or ecological unit we are interested in using the tigris pa ``` ```{r, echo=FALSE} -knitr::include_graphics("fulton_gwinnett_shape_maps.PNG") +# knitr::include_graphics("fulton_gwinnett_shape_maps.PNG") ``` We now will look at the block level of Fulton and Gwinnett county. @@ -362,7 +357,7 @@ We now will look at the block level of Fulton and Gwinnett county. ``` ```{r, echo=FALSE} -knitr::include_graphics("geo_combined_map_points_voters.PNG") +# knitr::include_graphics("geo_combined_map_points_voters_compressed.png") ``` ```{r} @@ -378,5 +373,5 @@ knitr::include_graphics("geo_combined_map_points_voters.PNG") ``` ```{r, echo=FALSE} -knitr::include_graphics("geo_combined_map_interactive_small.PNG") +# knitr::include_graphics("geo_combined_map_interactive_small_compressed.png") ``` diff --git a/vignettes/para_benchmark_box_nsamples.png b/vignettes/para_benchmark_box_nsamples.png deleted file mode 100644 index 0553adfe..00000000 Binary files a/vignettes/para_benchmark_box_nsamples.png and /dev/null differ diff --git a/vignettes/parallel_processing.Rmd b/vignettes/parallel_processing.Rmd index 0921ffaa..fa16dc7f 100644 --- a/vignettes/parallel_processing.Rmd +++ b/vignettes/parallel_processing.Rmd @@ -119,7 +119,7 @@ Depending on your dataset, the number of races and candidates you're analyzung, ```{r echo=FALSE, out.width='100%'} -knitr::include_graphics("para_benchmark_box_nsamples.png") +# knitr::include_graphics("para_benchmark_box_nsamples.png") ``` ## Summary diff --git a/vignettes/trace_density.png b/vignettes/trace_density.png deleted file mode 100644 index 6c91c71d..00000000 Binary files a/vignettes/trace_density.png and /dev/null differ diff --git a/vignettes/visualizations.Rmd b/vignettes/visualizations.Rmd index 3e9592cd..fc540f44 100644 --- a/vignettes/visualizations.Rmd +++ b/vignettes/visualizations.Rmd @@ -113,7 +113,7 @@ Let's look at the tomography plot for the Candidate for the Hispanic demographic ```{r echo=FALSE, out.width='100%'} -knitr::include_graphics("tomography_pct_montanez_pct_hisp.png") +# knitr::include_graphics("tomography_pct_montanez_pct_hisp.png") ``` @@ -123,7 +123,7 @@ These plots can be used to confirm this point estimate distributions for $\beta^ ```{r echo=FALSE, out.width='100%'} -knitr::include_graphics("density_pct_montanez_pct_hisp.png") +# knitr::include_graphics("density_pct_montanez_pct_hisp.png") ``` ### Density voter choice comparison plots for each race @@ -132,7 +132,7 @@ This overlaid density plot answers the question "How do voters from a certain ra ```{r echo=FALSE, out.width='100%'} -knitr::include_graphics("pct_husted_pct_button_asian.png") +# knitr::include_graphics("pct_husted_pct_button_asian.png") ``` @@ -143,7 +143,7 @@ Racially polarized voting by taking the difference of the posterior distribution ```{r echo=FALSE, out.width='100%'} -knitr::include_graphics("rpv_density.png") +# knitr::include_graphics("rpv_density.png") ``` @@ -168,7 +168,7 @@ The `coda` package enables creating trace and density plots, side-by-side for ea ```{r echo=FALSE, out.width='0.75\\linewidth'} -knitr::include_graphics("trace_density.png") +# knitr::include_graphics("trace_density.png") ``` @@ -176,7 +176,7 @@ knitr::include_graphics("trace_density.png") The Gelman-Rubin diagnostic is one method to test for convergence to see if the sample is close to the posterior distribution. You'll get one plot for each parameter and produces the scale reduction factor. In these plots you'll be looking to for values below a factor of ~1.1 so these plots will give you a good sense of any changes you'll need for burn-in. ```{r echo=FALSE, out.width='0.75\\linewidth'} -knitr::include_graphics("gelman.png") +# knitr::include_graphics("gelman.png") ``` diff --git a/vignettes/voter_data_df.PNG b/vignettes/voter_data_df.PNG deleted file mode 100644 index e24f914b..00000000 Binary files a/vignettes/voter_data_df.PNG and /dev/null differ