Skip to content

Commit

Permalink
Fix URLs and styling
Browse files Browse the repository at this point in the history
  • Loading branch information
mine-cetinkaya-rundel committed Jun 1, 2024
1 parent 186d88e commit 51a0fd7
Show file tree
Hide file tree
Showing 16 changed files with 63 additions and 64 deletions.
24 changes: 12 additions & 12 deletions R/data-gerrymander.R
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#'
#' @name gerrymander
#' @docType data
#' @format A data frame with 435 rows and 12 variables:
#' @format A data frame with 435 rows and 12 variables:
#' \describe{
#' \item{district}{Congressional district.}
#' \item{last_name}{Last name of 2016 election winner.}
Expand All @@ -22,18 +22,18 @@
#' @source [Washington Post](https://www.washingtonpost.com/news/wonk/wp/2014/05/15/americas-most-gerrymandered-congressional-districts/)
#' @keywords datasets
#'
#' @examples
#' @examples
#' library(ggplot2)
#' library(dplyr)
#' ggplot(gerrymander |> filter(gerry != "mid"), aes(clinton16, dem16, color = gerry)) +
#' geom_jitter(height = 0.05, size = 3, shape = 1) +
#' geom_smooth(method = "glm", method.args = list(family = "binomial"), se = FALSE) +
#' scale_color_manual(values = c("purple", "orange")) +
#' labs(
#' title = "Logistic Regression of 2016 House Elections",
#' subtitle = "by Congressional District",
#' x = "Percent of Presidential Vote Won by Clinton",
#' y = "Seat Won by Democrat Candidate",
#' color = "Gerrymandering"
#' )
#' geom_jitter(height = 0.05, size = 3, shape = 1) +
#' geom_smooth(method = "glm", method.args = list(family = "binomial"), se = FALSE) +
#' scale_color_manual(values = c("purple", "orange")) +
#' labs(
#' title = "Logistic Regression of 2016 House Elections",
#' subtitle = "by Congressional District",
#' x = "Percent of Presidential Vote Won by Clinton",
#' y = "Seat Won by Democrat Candidate",
#' color = "Gerrymandering"
#' )
"gerrymander"
5 changes: 2 additions & 3 deletions R/data-prez_pwr.R
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,7 @@
#' fill = "Respondent Party"
#' ) +
#' facet_wrap(~president)
#' @source
#' [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/).
#' @keywords datasets
#' @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/).
#' @keywords datasets
#'
"prez_pwr"
2 changes: 1 addition & 1 deletion R/data-prrace08.R
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
#' \item{p_mc_cain}{Proportion of votes for John McCain}
#' \item{el_votes}{Number of electoral votes for a state}
#' }
#' @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},
#' @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),
#' retrieved 2011-04-21.
#' @keywords datasets election 2008 president United States
#' @examples
Expand Down
4 changes: 2 additions & 2 deletions R/data-state_stats.R
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,9 @@
#' }
#' @source Census Quick Facts (no longer available as of 2020),
#' InfoChimps (also no longer available as of 2020),
#' \href{https://www-fars.nhtsa.dot.gov/Main/index.aspx}{National Highway Traffic Safety Administration},
#' [National Highway Traffic Safety Administration](https://www-fars.nhtsa.dot.gov/Main/index.aspx)
#' ({\code{tr_deaths}, \code{tr_deaths_no_alc}}),
#' \href{https://www.bls.gov/web/laus/laumstrk.htm}{Bureau of Labor Statistics}
#' [Bureau of Labor Statistics](https://www.bls.gov/web/laus/laumstrk.htm)
#' (\code{unempl}).
#' @keywords datasets state United States crime energy
#' @examples
Expand Down
2 changes: 1 addition & 1 deletion R/data-us_crime_rates.R
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
#' \item{vehicle_theft}{Number of vehicle thefts committed. Counted in property total.}
#' }
#'
#' @source \href{http://www.disastercenter.com/crime/uscrime.htm}{Disaster Center}
#' @source [Disaster Center](https://www.disastercenter.com/crime/uscrime.htm)
#'
#' @examples
#'
Expand Down
22 changes: 11 additions & 11 deletions R/data-us_time_survey.R
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#' American Time Survey 2009 - 2019
#'
#' Average Time Spent on Activities by Americans
#'
#'
#' @name us_time_survey
#' @docType data
#' @format A data frame with 11 rows and 8 variables.
Expand All @@ -14,20 +14,20 @@
#' \item{caring_children}{Average hours spent per day caring for and helping children under 18 years of age.}
#' \item{working_employed}{Average hours spent working for those employed. (15 years and older)}
#' \item{working_employed_days_worked}{Average hours per day spent working on days worked (15 years and older)}
#'
#'
#' }
#'
#' @examples
#'
#'library(ggplot2)
#'us_time_survey$year <-as.factor(us_time_survey$year)
#'ggplot(us_time_survey, aes(year, sleeping))+
#' geom_point(alpha = 0.3) +
#' labs( x= "Year",
#' y = "Average hours spent Sleeping",
#' title = "US Average hours spent sleeping, 2009 - 2019")
#'
#'
#' library(ggplot2)
#' us_time_survey$year <- as.factor(us_time_survey$year)
#' ggplot(us_time_survey, aes(year, sleeping)) +
#' geom_point(alpha = 0.3) +
#' labs(
#' x = "Year",
#' y = "Average hours spent Sleeping",
#' title = "US Average hours spent sleeping, 2009 - 2019"
#' )
#'
#' @source [US Bureau of Labor Statistics](https://www.bls.gov/tus/)
#' @keywords datasets
Expand Down
2 changes: 1 addition & 1 deletion R/data-vote_nsa.R
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
#' @references Kravets, D., 2020. Lawmakers Who Upheld NSA Phone Spying Received
#' Double The Defense Industry Cash. WIRED.
#' Available at \url{https://www.wired.com/2013/07/money-nsa-vote/}.
#' @source \href{https://www.maplight.org/}{MapLight}.
#' @source [MapLight](https://www.maplight.org/).
#' Available at \url{http://s3.documentcloud.org/documents/741074/amash-amendment-vote-maplight.pdf}.
#' @keywords datasets
#' @examples
Expand Down
2 changes: 1 addition & 1 deletion R/data-voter_count.R
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,6 @@
#' x = "Highest Office",
#' y = "Total Ballots"
#' )
#' @source \href{http://www.electproject.org/home/voter-turnout/voter-turnout-data}{United States Election Project}
#' @source [United States Election Project](https://www.electproject.org/election-data/voter-turnout-data)
#'
"voter_count"
18 changes: 10 additions & 8 deletions data-raw/gerrymander/gerrymander-dataprep.R
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,20 @@ raw_data <- read_csv(here::here("data-raw/gerrymander/isostat_congress_election_

# Cleaning: ------------------------------------------------------------------

clean_data <- raw_data |>
clean_names() |>
select(-x2) |>
separate(col = member2016,
into = c("last_name", "first_name"),
sep = ", ") |>
clean_data <- raw_data |>
clean_names() |>
select(-x2) |>
separate(
col = member2016,
into = c("last_name", "first_name"),
sep = ", "
) |>
mutate(
party16 = str_extract(party16, "[:alpha:]"),
party18 = str_extract(party18, "[:alpha:]"),
gerry = factor(gerry, levels = c("low", "mid", "high"))
)
)


gerrymander <- clean_data

Expand Down
1 change: 0 additions & 1 deletion data-raw/us_time_survey/us_time_survey-dataprep.R
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,3 @@ us_time_survey <- read_excel(here::here("data-raw/us_time_survey/AmericanTimeUse
# save --------------------------------------------------------------------------

usethis::use_data(us_time_survey, overwrite = TRUE)

20 changes: 10 additions & 10 deletions man/gerrymander.Rd

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

3 changes: 1 addition & 2 deletions man/prez_pwr.Rd

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

2 changes: 1 addition & 1 deletion man/state_stats.Rd

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

2 changes: 1 addition & 1 deletion man/us_crime_rates.Rd

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

16 changes: 8 additions & 8 deletions man/us_time_survey.Rd

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

2 changes: 1 addition & 1 deletion man/voter_count.Rd

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

0 comments on commit 51a0fd7

Please sign in to comment.