Skip to content

Commit a3e4178

Browse files
Merge pull request #2 from npaterno/master
Moving data set and documentation from openintro package to usdata package
2 parents e23a541 + 125bd2c commit a3e4178

7 files changed

Lines changed: 1029 additions & 1 deletion

File tree

DESCRIPTION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ License: GPL-3
1717
Encoding: UTF-8
1818
LazyData: true
1919
Roxygen: list(markdown = TRUE)
20-
RoxygenNote: 7.1.0
20+
RoxygenNote: 7.1.1
2121
URL: https://github.com/OpenIntroStat/usdata
2222
BugReports: https://github.com/OpenIntroStat/usdata/issues
2323
Suggests:

R/data-voter_count.R

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
#' US Voter Turnout Data.
2+
#'
3+
#' State-level data on federal elections held in November
4+
#' between 1980 and 2014.
5+
#'
6+
#' @format A data frame with 936 rows and 7 variables.
7+
#' \describe{
8+
#' \item{year}{Year election was held.}
9+
#' \item{region}{Specifies if data is state or national total.}
10+
#' \item{voting_eligible_population}{Number of citizens eligible to vote; does not count felons.}
11+
#' \item{total_ballots_counted}{Number of ballots cast.}
12+
#' \item{highest_office}{Number of ballots that contained a vote for the highest office of that election.}
13+
#' \item{percent_total_ballots_counted}{Overall voter turnout percentage.}
14+
#' \item{percent_highest_office}{Highest office voter turnout percentage.}
15+
#' }
16+
#'
17+
#' @examples
18+
#'
19+
#' library(ggplot2)
20+
#'
21+
#' ggplot(voter_count, aes(x = percent_highest_office, y = percent_total_ballots_counted)) +
22+
#' geom_point() +
23+
#' labs(
24+
#' title = "Total Ballots V Highest Office",
25+
#' x = "Highest Office",
26+
#' y = "Total Ballots"
27+
#' )
28+
#'
29+
#' @source \href{http://www.electproject.org/home/voter-turnout/voter-turnout-data}{United States Election Project}
30+
#'
31+
"voter_count"

_pkgdown.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ reference:
2727
- state_stats
2828
- urban_rural_pop
2929
- vote_nsa
30+
- voter_count
3031

3132
- title: Functions
3233
contents:

data-raw/voter_count/november_voter_turnout.csv

Lines changed: 937 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# load packages ----------------------------------------------------------------
2+
3+
library(readr)
4+
library(usethis)
5+
library(here)
6+
7+
# load data --------------------------------------------------------------------
8+
9+
voter_count <- read_csv(here::here("data-raw/voter_count", "november_voter_turnout.csv"))
10+
11+
# clean data: Change incorrect 0's values to NA --------------------------------
12+
13+
voter_count[voter_count == 0] <- NA
14+
15+
# save -------------------------------------------------------------------------
16+
17+
usethis::use_data(voter_count, overwrite= TRUE)

data/voter_count.rda

24.7 KB
Binary file not shown.

man/voter_count.Rd

Lines changed: 42 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)