Skip to content

Commit 51a0fd7

Browse files
Fix URLs and styling
1 parent 186d88e commit 51a0fd7

16 files changed

+63
-64
lines changed

R/data-gerrymander.R

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
#'
55
#' @name gerrymander
66
#' @docType data
7-
#' @format A data frame with 435 rows and 12 variables:
7+
#' @format A data frame with 435 rows and 12 variables:
88
#' \describe{
99
#' \item{district}{Congressional district.}
1010
#' \item{last_name}{Last name of 2016 election winner.}
@@ -22,18 +22,18 @@
2222
#' @source [Washington Post](https://www.washingtonpost.com/news/wonk/wp/2014/05/15/americas-most-gerrymandered-congressional-districts/)
2323
#' @keywords datasets
2424
#'
25-
#' @examples
25+
#' @examples
2626
#' library(ggplot2)
2727
#' library(dplyr)
2828
#' ggplot(gerrymander |> filter(gerry != "mid"), aes(clinton16, dem16, color = gerry)) +
29-
#' geom_jitter(height = 0.05, size = 3, shape = 1) +
30-
#' geom_smooth(method = "glm", method.args = list(family = "binomial"), se = FALSE) +
31-
#' scale_color_manual(values = c("purple", "orange")) +
32-
#' labs(
33-
#' title = "Logistic Regression of 2016 House Elections",
34-
#' subtitle = "by Congressional District",
35-
#' x = "Percent of Presidential Vote Won by Clinton",
36-
#' y = "Seat Won by Democrat Candidate",
37-
#' color = "Gerrymandering"
38-
#' )
29+
#' geom_jitter(height = 0.05, size = 3, shape = 1) +
30+
#' geom_smooth(method = "glm", method.args = list(family = "binomial"), se = FALSE) +
31+
#' scale_color_manual(values = c("purple", "orange")) +
32+
#' labs(
33+
#' title = "Logistic Regression of 2016 House Elections",
34+
#' subtitle = "by Congressional District",
35+
#' x = "Percent of Presidential Vote Won by Clinton",
36+
#' y = "Seat Won by Democrat Candidate",
37+
#' color = "Gerrymandering"
38+
#' )
3939
"gerrymander"

R/data-prez_pwr.R

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,7 @@
2525
#' fill = "Respondent Party"
2626
#' ) +
2727
#' facet_wrap(~president)
28-
#' @source
29-
#' [Pew Research Center, May 2006 & March 2012](https://www.pewresearch.org/fact-tank/2013/07/25/can-a-president-control-gas-prices-depends-on-when-you-ask/).
30-
#' @keywords datasets
28+
#' @source [Pew Research Center, May 2006 & March 2012](https://www.pewresearch.org/short-reads/2013/07/25/can-a-president-control-gas-prices-depends-on-when-you-ask/).
29+
#' @keywords datasets
3130
#'
3231
"prez_pwr"

R/data-prrace08.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
#' \item{p_mc_cain}{Proportion of votes for John McCain}
1818
#' \item{el_votes}{Number of electoral votes for a state}
1919
#' }
20-
#' @source \href{https://www.infoplease.com/us/government/elections/presidential-election-of-2008-electoral-and-popular-vote-summary}{Presidential Election of 2008, Electoral and Popular Vote Summary},
20+
#' @source [Presidential Election of 2008, Electoral and Popular Vote Summary](https://www.infoplease.com/us/government/elections/presidential-election-of-2008-electoral-and-popular-vote-summary),
2121
#' retrieved 2011-04-21.
2222
#' @keywords datasets election 2008 president United States
2323
#' @examples

R/data-state_stats.R

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,9 @@
3737
#' }
3838
#' @source Census Quick Facts (no longer available as of 2020),
3939
#' InfoChimps (also no longer available as of 2020),
40-
#' \href{https://www-fars.nhtsa.dot.gov/Main/index.aspx}{National Highway Traffic Safety Administration},
40+
#' [National Highway Traffic Safety Administration](https://www-fars.nhtsa.dot.gov/Main/index.aspx)
4141
#' ({\code{tr_deaths}, \code{tr_deaths_no_alc}}),
42-
#' \href{https://www.bls.gov/web/laus/laumstrk.htm}{Bureau of Labor Statistics}
42+
#' [Bureau of Labor Statistics](https://www.bls.gov/web/laus/laumstrk.htm)
4343
#' (\code{unempl}).
4444
#' @keywords datasets state United States crime energy
4545
#' @examples

R/data-us_crime_rates.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
#' \item{vehicle_theft}{Number of vehicle thefts committed. Counted in property total.}
2020
#' }
2121
#'
22-
#' @source \href{http://www.disastercenter.com/crime/uscrime.htm}{Disaster Center}
22+
#' @source [Disaster Center](https://www.disastercenter.com/crime/uscrime.htm)
2323
#'
2424
#' @examples
2525
#'

R/data-us_time_survey.R

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#' American Time Survey 2009 - 2019
22
#'
33
#' Average Time Spent on Activities by Americans
4-
#'
4+
#'
55
#' @name us_time_survey
66
#' @docType data
77
#' @format A data frame with 11 rows and 8 variables.
@@ -14,20 +14,20 @@
1414
#' \item{caring_children}{Average hours spent per day caring for and helping children under 18 years of age.}
1515
#' \item{working_employed}{Average hours spent working for those employed. (15 years and older)}
1616
#' \item{working_employed_days_worked}{Average hours per day spent working on days worked (15 years and older)}
17-
#'
17+
#'
1818
#' }
1919
#'
2020
#' @examples
2121
#'
22-
#'library(ggplot2)
23-
#'us_time_survey$year <-as.factor(us_time_survey$year)
24-
#'ggplot(us_time_survey, aes(year, sleeping))+
25-
#' geom_point(alpha = 0.3) +
26-
#' labs( x= "Year",
27-
#' y = "Average hours spent Sleeping",
28-
#' title = "US Average hours spent sleeping, 2009 - 2019")
29-
#'
30-
#'
22+
#' library(ggplot2)
23+
#' us_time_survey$year <- as.factor(us_time_survey$year)
24+
#' ggplot(us_time_survey, aes(year, sleeping)) +
25+
#' geom_point(alpha = 0.3) +
26+
#' labs(
27+
#' x = "Year",
28+
#' y = "Average hours spent Sleeping",
29+
#' title = "US Average hours spent sleeping, 2009 - 2019"
30+
#' )
3131
#'
3232
#' @source [US Bureau of Labor Statistics](https://www.bls.gov/tus/)
3333
#' @keywords datasets

R/data-vote_nsa.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
#' @references Kravets, D., 2020. Lawmakers Who Upheld NSA Phone Spying Received
2020
#' Double The Defense Industry Cash. WIRED.
2121
#' Available at \url{https://www.wired.com/2013/07/money-nsa-vote/}.
22-
#' @source \href{https://www.maplight.org/}{MapLight}.
22+
#' @source [MapLight](https://www.maplight.org/).
2323
#' Available at \url{http://s3.documentcloud.org/documents/741074/amash-amendment-vote-maplight.pdf}.
2424
#' @keywords datasets
2525
#' @examples

R/data-voter_count.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,6 @@
2525
#' x = "Highest Office",
2626
#' y = "Total Ballots"
2727
#' )
28-
#' @source \href{http://www.electproject.org/home/voter-turnout/voter-turnout-data}{United States Election Project}
28+
#' @source [United States Election Project](https://www.electproject.org/election-data/voter-turnout-data)
2929
#'
3030
"voter_count"

data-raw/gerrymander/gerrymander-dataprep.R

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,18 +10,20 @@ raw_data <- read_csv(here::here("data-raw/gerrymander/isostat_congress_election_
1010

1111
# Cleaning: ------------------------------------------------------------------
1212

13-
clean_data <- raw_data |>
14-
clean_names() |>
15-
select(-x2) |>
16-
separate(col = member2016,
17-
into = c("last_name", "first_name"),
18-
sep = ", ") |>
13+
clean_data <- raw_data |>
14+
clean_names() |>
15+
select(-x2) |>
16+
separate(
17+
col = member2016,
18+
into = c("last_name", "first_name"),
19+
sep = ", "
20+
) |>
1921
mutate(
2022
party16 = str_extract(party16, "[:alpha:]"),
2123
party18 = str_extract(party18, "[:alpha:]"),
2224
gerry = factor(gerry, levels = c("low", "mid", "high"))
23-
)
24-
25+
)
26+
2527

2628
gerrymander <- clean_data
2729

data-raw/us_time_survey/us_time_survey-dataprep.R

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,3 @@ us_time_survey <- read_excel(here::here("data-raw/us_time_survey/AmericanTimeUse
1010
# save --------------------------------------------------------------------------
1111

1212
usethis::use_data(us_time_survey, overwrite = TRUE)
13-

man/gerrymander.Rd

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

man/prez_pwr.Rd

Lines changed: 1 addition & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/state_stats.Rd

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/us_crime_rates.Rd

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/us_time_survey.Rd

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

man/voter_count.Rd

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)