Skip to content

Commit

Permalink
Fix doc
Browse files Browse the repository at this point in the history
  • Loading branch information
kuriwaki committed Oct 7, 2024
1 parent 5cc29d4 commit 7231497
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 17 deletions.
16 changes: 8 additions & 8 deletions R/datadoc_cd-info-long.R
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,18 @@
#' `cd_info_long` provides a "long" version of the yearly `cd_info_20**` datasets.
#'
#'
#' @format Each `cd_info_long*` is a dataframe with `r nrow(cd_info_long)`rows,
#' covering the maps of `r length(unique(cd_info_long$map))` election years
#' @format `cd_info_long` is a dataframe with `r nrow(cd_info_long)` rows,
#' covering the maps of `r length(unique(cd_info_long$lines))` election years
#' for each of the 435 congressional districts.
#' \describe{
#' \item{`lines`}{Is the year corresponding to the geography. For example, `map = 2008` and `cd = "AL-01`
#' \item{`lines`}{Is the year corresponding to the geography. For example, `lines = 2008` and `cd = "AL-01`
#' indicates that the row is representing AL-01's geography as used in the 2008 election.}
#' \item{`cd`}{Is the CD corresponding to the year of the map.}
#' \item{`cd`}{Is the CD corresponding to the year of the lines.}
#' \item{`elec`}{Is the year of the election for the presidential election data that follows}
#' \item{`party`, `candidate`}{Define the presidential candidate that corresponds to the `elec`
#' (which may not be the same as `map`). For example, `map = 2012, cd = AL-01` combined with
#' (which may not be the same as `lines`). For example, `lines = 2012, cd = AL-01` combined with
#' `elec = 2008` represents the 2008 election results in the AL-01 of the pre-redistricting 2008
#' map.}
#' lines.}
#' \item{`pct`}{are the two party voteshares of the candidate}
#' \item{`presvotes_total`}{Is the total number of votes for President in that CD}
#' }
Expand All @@ -23,10 +23,10 @@
#' library(dplyr)
#'
#' # get only data for proximate years
#' cd_info_long |> filter((map == lines) | (elec + 2 == lines))
#' cd_info_long |> filter((elec == lines) | (elec + 2 == lines))
#'
#' # this subset returns exactly 2 * 435 districts per cycle:
#' cd_info_long |> filter((map == lines) | (elec + 2 == lines)) |> count(lines, party)
#' cd_info_long |> filter((elec == lines) | (elec + 2 == lines)) |> count(lines, party)
#'
#' # this will show where the districts lines changed between 2022 and 2024
#' # (same election, same candidate, different map)
Expand Down
20 changes: 11 additions & 9 deletions man/cd_info_long.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 7231497

Please sign in to comment.