diff --git a/R/datasets.R b/R/datasets.R index 221dda0..dd600a1 100644 --- a/R/datasets.R +++ b/R/datasets.R @@ -15,5 +15,6 @@ #' @references #' @references #' @references +#' @references #' @usage data("debates2019") NULL \ No newline at end of file diff --git a/data-raw/2019-10-15-us-elections-debate-speaking-time.html b/data-raw/2019-10-15-us-elections-debate-speaking-time.html new file mode 100644 index 0000000..a002153 --- /dev/null +++ b/data-raw/2019-10-15-us-elections-debate-speaking-time.html @@ -0,0 +1,419 @@ + + + + Which Candidates Got the Most Speaking Time in the Democratic Debate - The New York Times + + + + + + + + + + + + + + + + + + + + + + + + + +

Which Candidates Got the Most Speaking Time in the Democratic Debate

+ + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + +
+ + + +

+ + How Long Each Candidate Spoke + + + + +

+ + + + + + +
+ + + + + + +
+ +

Impeachment

+
+ +
+ +

Health care

+
+ +
+ +

Economy

+
+ +
+ +

Income inequality

+
+ +
+ +

Middle East policy

+
+ +
+ +

Gun control

+
+ +
+ +

Opioids

+
+ +
+ +

Tech companies

+
+ +
+ +

Women’s rights

+
+ +
+ +

Party strategy

+
+ + + + +
+ + + + + + + + +
+
+
+ + + + + + + + + + + + + + + + +
+ +

+ Senator Elizabeth Warren of Massachusetts and former Vice President Joseph R. Biden Jr. had the most speaking time of the 12 Democratic presidential candidates in the fourth Democratic debate. +

+

+ All of the candidates voiced support for the House impeachment inquiry and many were sharply critical of President Trump’s decision to withdraw troops that were supporting Syria’s Kurds. Several candidates disagreed about ideas like “Medicare for all” and mandatory gun buyback programs, continuing a heated discussion from past debates about the best strategy for the Democratic party. +

+ + + + + + + + + + + + +
+ + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + + + + + +
+ +

+ Get full highlights from the debate in Westerville, Ohio. +

+ +
+ + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + +
+ +
+ + + + \ No newline at end of file diff --git a/data-raw/debates2019.R b/data-raw/debates2019.R index 4314ddc..fb3466f 100644 --- a/data-raw/debates2019.R +++ b/data-raw/debates2019.R @@ -21,6 +21,7 @@ if (!file.exists(here::here("data-raw/2019-06-27-us-elections-debate-speaking-ti if (!file.exists(here::here("data-raw/2019-07-30-us-elections-debate-speaking-time.html"))) download.file("https://www.nytimes.com/interactive/2019/07/30/us/elections/debate-speaking-time.html", here::here("data-raw/2019-07-30-us-elections-debate-speaking-time.html")) if (!file.exists(here::here("data-raw/2019-07-31-us-elections-debate-speaking-time.html"))) download.file("https://www.nytimes.com/interactive/2019/07/31/us/elections/debate-speaking-time.html", here::here("data-raw/2019-07-31-us-elections-debate-speaking-time.html")) if (!file.exists(here::here("data-raw/2019-09-12-us-elections-debate-speaking-time.html"))) download.file("https://www.nytimes.com/interactive/2019/09/12/us/elections/debate-speaking-time.html", here::here("data-raw/2019-09-12-us-elections-debate-speaking-time.html")) +if (!file.exists(here::here("data-raw/2019-10-15-us-elections-debate-speaking-time.html"))) download.file("https://www.nytimes.com/interactive/2019/10/15/us/elections/debate-speaking-time.html", here::here("data-raw/2019-10-15-us-elections-debate-speaking-time.html")) read_html(here::here("data-raw/2019-06-26-us-elections-debate-speaking-time.html")) %>% html_nodes(xpath = ".//script[contains(., 'NYTG_DEMDEBATES')]") %>% @@ -252,12 +253,59 @@ read_html(here::here("data-raw/2019-09-12-us-elections-debate-speaking-time.html ) %>% as_tibble() -> sep_day_1 +read_html(here::here("data-raw/2019-10-15-us-elections-debate-speaking-time.html")) %>% + html_nodes(xpath = ".//script[contains(., 'NYTG_DEMDEBATES')]") %>% + html_text() %>% + stri_split_lines() %>% + unlist() %>% + .[3] %>% + stri_replace_first_regex("^.*NYTG_DEMDEBATES = ", "") %>% + jsonlite::fromJSON() %>% + mutate( + elapsed = as.numeric(elapsed)/60, + debate_date = as.Date("2019-10-15"), + speaker = stri_trans_totitle(speaker), + timestamp = parse_time(timestamp), + debate_group = 4, + night = 1 + ) %>% + mutate( + speaker = case_when( + speaker == "Orourke" ~ "O'Rourke", + TRUE ~ speaker + ) + ) %>% + mutate( + topic = case_when( + topic == "" ~ "Other", + grepl("impeachment", topic) ~ "Impeachment", + grepl("economy", topic) ~ "Economy", + grepl("opioids", topic) ~ "Opioids", + grepl("candidate-age", topic) ~ "Age", + grepl("tech-companies", topic) ~ "Tech Companies", + grepl("middle-east policy", topic) ~ "Foreign Policy", + grepl("gun-control", topic) ~ "Gun Control", + grepl("income-inequality", topic) ~ "Income Inequality", + grepl("health-care", topic) ~ "Healthcare", + grepl("party-strategy", topic) ~ "Party Strategy", + grepl("womens-rights", topic) ~ "Women's Rights", + TRUE ~ topic + ) + ) %>% + filter( + !is.na(timestamp), + speaker != "", + speaker != "Moderator" + ) %>% + as_tibble() -> oct_day_1 + bind_rows( jun_day_1, jun_day_2, jul_day_1, jul_day_2, - sep_day_1 + sep_day_1, + oct_day_1 ) -> debates2019 usethis::use_data(debates2019, overwrite = TRUE) diff --git a/data/debates2019.rda b/data/debates2019.rda index 94ae578..3d8e777 100644 Binary files a/data/debates2019.rda and b/data/debates2019.rda differ diff --git a/man/debates2019.Rd b/man/debates2019.Rd index 6137e43..e8637e5 100644 --- a/man/debates2019.Rd +++ b/man/debates2019.Rd @@ -26,5 +26,7 @@ metadata and opening/closing statement records. \url{https://www.nytimes.com/interactive/2019/07/31/us/elections/debate-speaking-time.html} \url{https://www.nytimes.com/interactive/2019/09/12/us/elections/debate-speaking-time.html} + +\url{https://www.nytimes.com/interactive/2019/10/15/us/elections/debate-speaking-time.html} } \keyword{datasets}