diff --git a/DESCRIPTION b/DESCRIPTION index 2abb212..0993efb 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,8 +1,8 @@ Package: ggchicklet Type: Package Title: Create 'Chicklet' (Rounded Segmented Column) Charts -Version: 0.1.0 -Date: 2019-06-28 +Version: 0.2.0 +Date: 2019-09-15 Authors@R: c( person("Bob", "Rudis", email = "bob@rud.is", role = c("aut", "cre"), comment = c(ORCID = "0000-0001-5670-2640")), person("Antoine", "Bichat", role = "ctb") ) diff --git a/R/datasets.R b/R/datasets.R index a6555d1..221dda0 100644 --- a/R/datasets.R +++ b/R/datasets.R @@ -1,15 +1,19 @@ #' @md -#' @title June 2019 U.S. Democratic Debate Candidate/Topic Times +#' @title 2019-2020 U.S. Democratic Debate Candidate/Topic Times #' @description The New York Times and other media outlets kept track of the time each #' candidate spent talking including the timestamp of the start of the blathering #' and the topic up for debate. This dataset only includes candidates and #' topic times. The complete datasets (See References) also include moderator #' metadata and opening/closing statement records. -#' @format data frame with columns: `elapsed` (dbl), `timestamp` (drtn), `speaker` (chr), `topic` (chr) +#' @format data frame with columns: `elapsed` (dbl), `timestamp` (time), `speaker` (chr), `topic` (chr) +#' `debate_date` (date), `debate_group` (dbl), `night` (dbl) #' @docType data #' @keywords datasets #' @name debates2019 -#' @references -#' @references +#' @references +#' @references +#' @references +#' @references +#' @references #' @usage data("debates2019") NULL \ No newline at end of file diff --git a/README.Rmd b/README.Rmd index 14a001c..1a683d1 100644 --- a/README.Rmd +++ b/README.Rmd @@ -53,6 +53,7 @@ library(tidyverse) data("debates2019") debates2019 %>% + filter(debate_group == 1) %>% mutate(speaker = fct_reorder(speaker, elapsed, sum, .desc=FALSE)) %>% mutate(topic = fct_other( topic, @@ -92,8 +93,6 @@ debates2019 %>% theme_ipsum_rc(grid="X") + theme(axis.text.x = element_text(color = "gray60", size = 10)) + theme(legend.position = "top") - - ``` ## ggchicklet Metrics diff --git a/README.md b/README.md index 0ab93af..c8ce45a 100644 --- a/README.md +++ b/README.md @@ -26,7 +26,7 @@ segmented column charts (i.e. “chicklets”). ## What’s Inside The Tin - - `debates2019`: June 2019 U.S. Democratic Debate Candidate/Topic + - `debates2019`: 2019-2020 U.S. Democratic Debate Candidate/Topic Times - `geom_chicklet`: Chicklet (rounded segmented column) charts @@ -58,7 +58,7 @@ library(ggchicklet) # current version packageVersion("ggchicklet") -## [1] '0.1.0' +## [1] '0.2.0' ``` ### From the NYTimes @@ -70,6 +70,7 @@ library(tidyverse) data("debates2019") debates2019 %>% + filter(debate_group == 1) %>% mutate(speaker = fct_reorder(speaker, elapsed, sum, .desc=FALSE)) %>% mutate(topic = fct_other( topic, @@ -115,10 +116,11 @@ debates2019 %>% ## ggchicklet Metrics -| Lang | \# Files | (%) | LoC | (%) | Blank lines | (%) | \# Lines | (%) | -| :--- | -------: | --: | --: | ---: | ----------: | ---: | -------: | ---: | -| R | 8 | 0.8 | 119 | 0.52 | 27 | 0.36 | 105 | 0.55 | -| Rmd | 2 | 0.2 | 109 | 0.48 | 47 | 0.64 | 85 | 0.45 | +| Lang | \# Files | (%) | LoC | (%) | Blank lines | (%) | \# Lines | (%) | +| :--- | -------: | ---: | ---: | ---: | ----------: | ---: | -------: | ---: | +| HTML | 5 | 0.33 | 7860 | 0.94 | 1858 | 0.96 | 239 | 0.54 | +| R | 8 | 0.53 | 350 | 0.04 | 34 | 0.02 | 121 | 0.27 | +| Rmd | 2 | 0.13 | 117 | 0.01 | 45 | 0.02 | 85 | 0.19 | ## Code of Conduct diff --git a/data-raw/2019-06-26-us-elections-debate-speaking-time.html b/data-raw/2019-06-26-us-elections-debate-speaking-time.html new file mode 100644 index 0000000..e9841e3 --- /dev/null +++ b/data-raw/2019-06-26-us-elections-debate-speaking-time.html @@ -0,0 +1,3523 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +Which Candidates and Topics Got the Most Time During the Democratic Debate - The New York Times + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
+ +
+
+ +
+ +
+
+ + + + +
+ + + + + + +
+ + +
+ + +

How Long Each Candidate Spoke

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

Economy

+
+ +
+ +

Health care

+
+ +
+ +

Immigration

+
+ +
+ +

Gun control

+
+ +
+ +

Climate change

+
+ +
+ +

Foreign policy

+
+ + + + +
+ + +
+ +

How Long Each Candidate Spoke

+ + +
+ +
+ + +
+ + +
+ + + Each bar segment represents the length of a candidate’s response to a question. +
+ + +
+ + + + +
+ + + + +
+ + +

Senator Cory Booker of New Jersey and Beto O’Rourke, a former congressman from Texas, spoke the most during the first Democratic presidential debate. Ten candidates participated on Wednesday, and 10 more will be part of a second debate on Thursday.

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

Here are some key questions the candidates were asked, where they found common ground and where they disagreed.

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

How Would You Address Gun Violence?

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

The candidates mostly agreed on the need to tighten the country’s gun laws, though some highlighted different priorities.

+ + + + +
+ + + + +
+ + + + + + +
+ + + +
+
+ + ElizabethWarren +
+
+ We need to treat it like a serious research problem which we have not done. +
+
+ + + +
+
+ + TimRyan +
+
+ We need to start dealing with the trauma that our kids have. We need trauma-based care in every school. +
+
+ + + +
+
+ + Billde Blasio +
+
+ If we’re going to stop these shootings we have to get these guns off the streets. We have to have a very different relationship between our police and our community. +
+
+ + + +
+
+ + CoryBooker +
+
+ If you need a license to drive a car, you should need a license to buy and own a firearm. +
+
+ + + +
+ + + +
+ + + + +
+ + +

Should Illegal Entry Be a Crime?

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

The two Texans, Julián Castro and Mr. O’Rourke, disagreed over whether to maintain a section of the law that criminalizes illegal entry into the United States. Mr. Castro’s plan would downgrade illegal entry to a civil offense.

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

Mr. Booker and Representative Tim Ryan of Ohio agreed with Mr. Castro.

+ + + + +
+ + + + +
+ + + + + + +
+ + + +
+
+ + JuliánCastro +
+
+ They use that law, section 1325, to justify under the law, separating little children from their families. I want to challenge every candidate on this stage to support the repeal of section 1325. +
+
+ + + +
+
+ + CoryBooker +
+
+ I agree with him on that issue, but folks should understand that the separation of children from families doesn’t just go on at our border. It happens in our communities as ICE are ripping away parents from their American children, spouses and the like. +
+
+ + + +
+
+ + TimRyan +
+
+ There are other provisions in the law that will allow you to prosecute people for coming over if they are dealing in drugs and other things. That's already established in the law. There is no need to repeat it. +
+
+ + + +
+ + + +
+ + + + +
+ + +

Mr. O’Rourke has said that he wants to ensure there is a legal mechanism to address criminals crossing the border illegally. Senator Amy Klobuchar of Minnesota did not commit to a position, but appeared to have the same concerns as Mr. O’Rourke.

+ + + + +
+ + + + +
+ + + + + + +
+ + + +
+
+ + BetoO’Rourke +
+
+ If we apprehend a known smuggler or drug trafficker, we’re going to ensure that they are deported and criminally prosecuted. +
+
+ + + +
+
+ + AmyKlobuchar +
+
+ I am happy to look at his proposal, but I do think you want to make sure that you have provisions in place that allow you to go after traffickers and allow you to go after people who are violating the law. +
+
+ + + +
+ + + +
+ + + + +
+ + +

Bill DeBlasio, mayor of New York, interjected with a line that garnered applause from the audience.

+ + + + +
+ + + + +
+ + + + + + +
+ + + +
+
+ + Billde Blasio +
+
+ We have to get under the skin of why we have this crisis in our system, because we’re not being honest about the division that’s been fomented in this country. The way that American citizens have been told that immigrants somehow created their misery and their pain and their challenges. +
+
+ + + +
+ + + +
+ + + + +
+ + +

“Medicare for All” or “Public Option”?

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

Two candidates raised their hands when asked whether they supported abolishing private health insurance in favor of a government-run plan, often called “Medicare for all”: Senator Elizabeth Warren of Massachusetts and Mr. de Blasio.

+ + + + +
+ + + + +
+ + + + + + +
+ + + +
+
+ + ElizabethWarren +
+
+ Yes, I’m with Bernie on Medicare-for-all. +
+
+ + + +
+
+ + Billde Blasio +
+
+ Private insurance is not working for tens of millions of Americans. +
+
+ + + +
+ + + +
+ + + + +
+ + +

Other candidates expressed support for a public option, in which everyone would have the option to buy a government-run health care plan, while still giving people the option to buy private insurance, at least in the immediate future.

+ + + + +
+ + + + +
+ + + + + + +
+ + + +
+
+ + JohnDelaney +
+
+ We should give everyone in this country health care as a basic human right for free — full stop. But we should also give them the option to buy private insurance. +
+
+ + + +
+
+ + BetoO’Rourke +
+
+ We preserve choice by making sure that everyone has health care. No, I think that choice is fundamental to our ability to have everyone cared for. +
+
+ + + +
+
+ + TulsiGabbard +
+
+ I also think if you look at other countries in the world who have universal health care, everyone of them has some form of a role of private insurance. +
+
+ + + +
+
+ + AmyKlobuchar +
+
+ I think it is a beginning and the way you start and the way you move to universal health care. +
+
+ + + +
+
+ + CoryBooker +
+
+ When I am president of the United States, I’m not going to wait. We have to do the things immediately that are going to provide better care. +
+
+ + + +
+ + + +
+ + + + +
+ + +

What Is the Greatest Geopolitical Threat to the United States?

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

Here is how each candidate responded (some gave more than one answer).

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

Climate Change

+
+
+

Russia

+
+
+

Donald Trump

+
+
+

O’Rourke

+
+
+

Warren

+
+
+

de Blasio

+
+
+

Inslee

+
+
+

Castro

+
+
+

Booker

+
+
+

Iran

+
+
+

China

+
+
+

Nuclear Weapons

+
+
+

Klobuchar

+
+
+

Ryan

+
+
+

Delaney

+
+
+

Gabbard

+
+
+ + +
+ +
+

Climate Change

+
+
+

Russia

+
+
+

Donald Trump

+
+
+

O’Rourke

+
+
+

Warren

+
+
+

de Blasio

+
+
+

Inslee

+
+
+

Castro

+
+
+

Booker

+
+
+

Iran

+
+
+

China

+
+
+

Nuclear Weapons

+
+
+

Klobuchar

+
+
+

Ryan

+
+
+

Delaney

+
+
+

Gabbard

+
+
+ + +
+ +
+

Climate Change

+
+
+

Russia

+
+
+

Donald Trump

+
+
+

O’Rourke

+
+
+

Warren

+
+
+

de Blasio

+
+
+

Inslee

+
+
+

Castro

+
+
+

Booker

+
+
+

Iran

+
+
+

China

+
+
+

Nuclear Weapons

+
+
+

Klobuchar

+
+
+

Ryan

+
+
+

Delaney

+
+
+

Gabbard

+
+
+ + +
+ +
+

Climate Change

+
+
+

O’Rourke

+
+
+

Warren

+
+
+

Castro

+
+
+

Booker

+
+
+

China

+
+
+

Nuclear Weapons

+
+
+

Ryan

+
+
+

Gabbard

+
+
+

Delaney

+
+
+

Klobuchar

+
+
+

Iran

+
+
+

Donald Trump

+
+
+

Inslee

+
+
+

Russia

+
+
+

de Blasio

+
+
+ + +
+ +
+

Climate Change

+
+
+

O’Rourke

+
+
+

Warren

+
+
+

Castro

+
+
+

Booker

+
+
+

China

+
+
+

Nuclear

+

Weapons

+
+
+

Ryan

+
+
+

Delaney

+
+
+

Gabbard

+
+
+

Klobuchar

+
+
+

Iran

+
+
+

Donald Trump

+
+
+

Russia

+
+
+

Inslee

+
+
+

de Blasio

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

What Makes Them Different

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

This question wasn’t asked, but several candidates found ways to highlight their accomplishments and life experiences to try to stand out.

+ + + + +
+ + + + +
+ + + + + + +
+ + + +
+
+ + AmyKlobuchar +
+
+ In fact, Donald Trump, one of the first bills that he signed of the 34 he signed where I was the lead Democrat – okay that’s a first up here – was one that was about that, making sure minority community members could share in those jobs. +
+
+ + + +
+
+ + JohnDelaney +
+
+ You know, I’m very different than everyone else here on this stage. Prior to being in Congress, I was an entrepreneur. I started two businesses. I created thousands of jobs. +
+
+ + + +
+
+ + Billde Blasio +
+
+ I also want to say there’s something that sets me apart from all my colleagues running in this race and that is, for the last 21 years, I’ve been raising a black son in America. And I have had to have very very serious talks with my son Dante about how to protect himself on the streets of our city and all over this country. +
+
+ + + +
+
+ + JayInslee +
+
+ On climate change: “And I am the only candidate – frankly, I’m surprised – I’m the only candidate who’s made this commitment to make it the top priority.” +
+
+ + + +
+
+ + JuliánCastro +
+
+ I’m proud that I’m the only candidate so far that has put forward legislation that would reform our policing system in America and make sure that no matter what the color of your skin is that you’re treated the same, including Latinos who are mistreated too often times by police. +
+
+ + + +
+ + + +
+ + + + +
+ + +

Where They Are From

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

Many candidates talked about their identities — citing their home states, their upbringing and their families.

+ + + + +
+ + + + +
+ + + + + + +
+ + + +
+
+ + JuliánCastro +
+
+ I grew up with a mother who raised my brother Joaquin and me as a single parent. And I know what it’s like to struggle. +
+
+ + + +
+
+ + ElizabethWarren +
+
+ By the time I graduated from high school, my family, my family didn’t have the money for a college application, much less a chance for me to go to college. +
+
+ + + +
+
+ + AmyKlobuchar +
+
+ My own dad and my sister got their first degrees with community college. There’s many paths to success as well as certifications. Secondly, I’ve used Pell grants. +
+
+ + + +
+
+ + JuliánCastro +
+
+ Like many of you, I know the promise of America. My grandmother came here when she was 7 years old as an immigrant from Mexico. +
+
+ + + +
+
+ + TimRyan +
+
+ I’ve had family members that had to unbolt a machine from the factory floor, put it in a box and ship it to China. My area where I come from in northeast Ohio, this issue we’re talking about here, it’s been going on forty years. +
+
+ + + +
+
+ + CoryBooker +
+
+ I live in a low-income black and brown community. I see every single day that this economy is not working for average Americans. +
+
+ + + +
+
+ + JohnDelaney +
+
+ My dad was a union electrician. Right, I actually grew up in a working class family. He loved the health care that the I.B.E.W. gave him. +
+
+ + + +
+ + + +
+ + + + + + + + + +
+ + +

+ + + + +
+ + + + + +
+ + + + + +
+
+ + + + + + +
+ + +
+
+ +
+
+ + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/data-raw/2019-06-27-us-elections-debate-speaking-time.html b/data-raw/2019-06-27-us-elections-debate-speaking-time.html new file mode 100644 index 0000000..22060e4 --- /dev/null +++ b/data-raw/2019-06-27-us-elections-debate-speaking-time.html @@ -0,0 +1,3344 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +Which Candidates and Topics Got the Most Time During the Second Democratic Debate - The New York Times + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
+ +
+
+ +
+ +
+
+ + + + +
+ + + + + + +
+ + +
+ + +

How Long Each Candidate Spoke

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

Economy

+
+ +
+ +

Health care

+
+ +
+ +

Immigration

+
+ +
+ +

Gun control

+
+ +
+ +

Civil rights

+
+ +
+ +

Climate change

+
+ +
+ +

Foreign policy

+
+ + + + +
+ + +
+ +

How Long Each Candidate Spoke

+ + +
+ +
+ + +
+ + + +
+ + + Each bar segment represents the length of a candidate’s response to a question. +
+ + +
+ + + + +
+ + + + +
+ + +

Former vice president Joseph R. Biden Jr. and Senator Kamala Harris of California spoke the most during Thursday night’s Democratic presidential debate. It was the second debate of the week after 10 other candidates opened the 2020 campaign on Wednesday.

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

The candidates in the second debate spent more time discussing civil rights and spent less time on jobs and the economy.

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

First debate

+
+
+

0

+
+
+

10

+
+
+

20

+
+
+

30

+
+
+

40

+
+
+

50

+
+
+

60

+
+
+

70

+
+
+

80 min.

+
+
+

Economy

+
+
+

Immigration

+
+
+

Health care

+
+
+

Gun control

+
+
+

Foreign

+

policy

+
+
+

Climate

+

change

+
+
+

Other

+
+
+

Second debate

+
+
+

Immigration

+
+
+

Health care

+
+
+

Civil

+

rights

+
+
+

Foreign

+

policy

+
+
+

Climate

+

change

+
+
+

Economy

+
+
+

Gun

+

control

+
+
+ + +
+ +
+

First

+

debate

+
+
+

Second

+

debate

+
+
+

0

+
+
+

Economy

+
+
+

Immigration

+
+
+

10

+
+
+

Immigration

+
+
+

Health care

+
+
+

20

+
+
+

Civil rights

+
+
+

30

+
+
+

Health care

+
+
+

Foreign policy

+
+
+

40

+
+
+

Climate change

+
+
+

Gun control

+
+
+

Economy

+
+
+

50

+
+
+

Foreign policy

+
+
+

Gun control

+
+
+

Climate change

+
+
+

60

+
+
+

Other

+
+
+

70

+
+
+

80 min.

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

Here are some key questions the candidates were asked, where they found common ground and where they disagreed.

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

What Is the First Issue for Your Presidency?

+ + + + +
+ + + + +
+ + + + + + +
+ + + +
+
+ + Eric Swalwell +
+
+ “For Parkland, for Orlando, for every community affected by gun violence — ending gun violence.” +
+
+ + + +
+
+ + Michael Bennet +
+
+ “Climate change” +
+
+ + + +
+
+ + Kirsten Gillibrand +
+
+ “Passing a family bill of rights that includes a national paid leave plan.” +
+
+ + + +
+
+ + Kamala Harris +
+
+ “Passing a middle class working families tax cut.” +
+
+ + + +
+
+ + Bernie Sanders +
+
+ “I reject the premise,” he said. “We need a political revolution.” +
+
+ + + +
+
+ + Joseph R. Biden Jr. +
+
+ “The first thing I would do is make sure that we defeat Donald Trump.” +
+
+ + + +
+
+ + Pete Buttigieg +
+
+ “We’ve got to fix our democracy before it’s too late.” +
+
+ + + +
+
+ + Andrew Yang +
+
+ “I would pass a $1,000 freedom dividend for every American adult.” +
+
+ + + +
+
+ + John Hickenlooper +
+
+ “I would do a collaborative approach to climate change.” +
+
+ + + +
+
+ + Marianne Williamson +
+
+ “The United States of America is going to be the best place in the world for a child to grow up.” +
+
+ + + +
+ + + +
+ + + + +
+ + +

“Medicare for All” or “Public Option”?

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

When the moderator asked who would abolish private health insurance in favor of a government-run plan, only Senator Bernie Sanders of Vermont and Ms. Harris raised their hands. Senator Kirsten Gillibrand of New York explained that she supports Mr. Sanders’ “Medicare for all” bill, but that it will have a transition period for people to actively buy-in.

+ + + + +
+ + + + +
+ + + + + + +
+ + + +
+
+ + Bernie Sanders +
+
+ People don’t like their private insurance companies, they like their doctors and hospitals. Under our plan, people go to any doctor they want, any hospital they want. +
+
+ + + +
+
+ + Kirsten Gillibrand +
+
+ The quickest way you get there is create competition with the insurers. God bless the insurers if they want to compete. +
+
+ + + +
+ + + +
+ + + + +
+ + +

Other candidates who addressed the question said they preferred some kind of public option for a government-run plan while still maintaining the private insurance system, at least in the immediate future.

+ + + + +
+ + + + +
+ + + + + + +
+ + + +
+
+ + Pete Buttigieg +
+
+ Mr. Buttigieg said that a plan that offers Medicare for those who want it “will be a natural glide path to the single payer environment.” +
+
+ + + +
+
+ + Joseph R. Biden Jr. +
+
+ The quickest, fastest way to do it is build on Obamacare, to build on what we did. And secondly, to make sure that everyone does have an option. +
+
+ + + +
+
+ + Michael Bennet +
+
+ I feel very strongly that families ought to be able to have this choice. +
+
+ + + +
+
+ + John Hickenlooper +
+
+ You can’t eliminate private insurance for 180 million people, many who don’t want to give it up. +
+
+ + + +
+ + + +
+ + + + +
+ + +

The Future of the Party

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

Several candidates made pitches for the direction of the Democratic party. Representative Eric Swalwell of California directly went after Mr. Biden’s age, and Mr. Sanders pivoted from a question about diversity in the party to reiterate his economic message.

+ + + + +
+ + + + +
+ + + + + + +
+ + + +
+
+ + Eric Swalwell +
+
+ If we’re going to solve the issues of climate chaos, pass the torch. If we’re going to solve the issue of student loan debt, pass the torch. If we’re going to end gun violence for families who are fearful of sending their kids to school, pass the torch. +
+
+ + + +
+
+ + Bernie Sanders +
+
+ We need a party that is diverse, but we need a party that has the guts to stand up to the powerful special interests who have so much power over the economic and political life of this country. +
+
+ + + +
+ + + +
+ + + + +
+ + +

Former Gov. John Hickenlooper of Colorado was asked to address his criticism of Mr. Sanders’ policies, and Ms. Gillbrand attempted to provide middle ground.

+ + + + +
+ + + + +
+ + + + + + +
+ + + +
+
+ + John Hickenlooper +
+
+ Well, I think that the bottom line is if we don’t clearly define that we are not socialists, the Republicans are going to come at us every way they can and call us socialists. +
+
+ + + +
+
+ + Kirsten Gillibrand +
+
+ I disagree with both their perspectives. The debate we’re having in our party right now is confusing. Because the truth is there’s a big difference between capitalism on the one hand and greed on the other. +
+
+ + + +
+ + + +
+ + + + +
+ + +

How Their Experiences Have Shaped Them

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

Several candidates referenced personal challenges as a way to discuss their policies. On health care, Mr. Biden mentioned a tragic accident in his family, and Senator Michael Bennet of Colorado brought up his own cancer diagnosis as he argued to build on the Affordable Care Act.

+ + + + +
+ + + + +
+ + + + + + +
+ + + +
+
+ + Joseph R. Biden Jr. +
+
+ Look, this is very personal to me. When my wife and daughter were killed in an automobile accident, my two boys were really very badly injured, I couldn’t imagine what it’d be like if I had not had adequate healthcare immediately. +
+
+ + + +
+
+ + Michael Bennet +
+
+ I had prostate cancer recently, as you may know, and it’s why I was a little late getting in the race. The same week my kid had her appendectomy out, and I feel very strongly that families ought to be able to have this choice. +
+
+ + + +
+ + + +
+ + + + +
+ + +

On student debt:

+ + + + +
+ + + + +
+ + + + + + +
+ + + +
+
+ + Pete Buttigieg +
+
+ So college affordability is personal for us. Chasten and I have six figure student debt. I believe in reducing student debt. +
+
+ + + +
+ + + +
+ + + + +
+ + +

Ms. Harris challenged Mr. Biden on his opposition to busing during the 1970s and 1980s by describing her experience as a child.

+ + + + +
+ + + + +
+ + + + + + +
+ + + +
+
+ + Kamala Harris +
+
+ There was a little girl in California who was a part of the second class to integrate her public schools and she was bused to school every day. And that little girl was me. So I will tell you that on this subject, it cannot be an intellectual debate among Democrats. +
+
+ + + +
+ + + +
+ + + + +
+ + +

Should Illegal Entry Be a Crime?

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

The candidates were asked if it should be a civil offense instead of a crime to cross the United States border without documentation. Mr. Bennet appeared to be the only candidate not to raise his hand, while Mr. Biden simply said that he would not emphasize the deportation of undocumented immigrants who have not committed a serious crime.

+ + + + +
+ + + + +
+ + + + + + +
+ + + +
+
+ + Pete Buttigieg +
+
+ Mr. Buttigieg said that criminalizing illegal entry “is the basis for family separation. You do away with that, it’s no longer possible.” +
+
+ + + +
+
+ + Joseph R. Biden Jr. +
+
+ That person should not be the focus of deportation. +
+
+ + + +
+ + + +
+ + + + +
+ + +

Ms. Harris turned to face Mr. Biden as she brought up the Obama administration’s deportation policy.

+ + + + +
+ + + + +
+ + + + + + +
+ + + +
+
+ + Kamala Harris +
+
+ And on this issue, I disagreed with my president. Because the policy was to allow deportation of people who by ICE’s own definition were non-criminals. +
+
+ + + +
+ + + +
+ + + + + + + + + +
+ + +

+ + + + +
+ + + + + +
+ + + + + +
+
+ + + + + + +
+ + +
+
+ +
+
+ + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/data-raw/2019-07-30-us-elections-debate-speaking-time.html b/data-raw/2019-07-30-us-elections-debate-speaking-time.html new file mode 100644 index 0000000..f89d4cf --- /dev/null +++ b/data-raw/2019-07-30-us-elections-debate-speaking-time.html @@ -0,0 +1,1491 @@ + + + + Which Candidates and Topics Got the Most Speaking Time During the Democratic Debate - The New York Times + + + + + + + + + + + + + + + + + + + + + + + +

Which Candidates and Topics Got the Most Speaking Time During the Democratic Debate

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

+ + How Long Each Candidate Spoke + +

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

Health care

+
+ +
+ +

Immigration

+
+ +
+ +

Gun control

+
+ +
+ +

Party strategy

+
+ +
+ +

Climate change

+
+ +
+ +

Economy

+
+ +
+ +

Foreign policy

+
+ +
+ +

Civil rights

+
+ + + + +
+ + + + + + + + +
+ + +
+ +
+ +
+ + + + + + + + + + + + + + + + + + + + + +
+ + + Each bar segment represents the length of a candidate’s response to a question. +
+ + +
+ +

+ Senators Elizabeth Warren and Bernie Sanders spoke the most during Tuesday night’s Democratic presidential debate. In addition to core issues like health care and immigration, candidates spent significant time debating the best political strategy to defeat President Trump and how to address racial and economic inequality. +

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

+ The debate featured clashes over policy between the progressive favorites, Ms. Warren and Mr. Sanders, and the moderate underdogs that flanked them. Here are key quotes that showed how the candidates sparred over different issues. +

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

+ Health care + Ryan Challenges Sanders on Benefits For Union Members + +

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

Tim Ryan

+
+
+

“This plan that’s being offered by Senator Warren and Senator Sanders will tell those union members, who gave away wages in order to get good health care, that they will lose their health care because Washington is going to come in and tell them they have a better plan.”

+
+
+

The moderator asks Sanders if the benefits under “Medicare for All” will be as good as the ones the unions negotiated.

+
+
+

Bernie Sanders

+
+
+

“They will be better, because Medicare for All is comprehensive and covers all health care needs for senior citizens.”

+
+
+

Tim Ryan

+
+
+

“You don’t know that, Bernie.”

+
+
+

Bernie Sanders

+
+
+

“I do know it, I wrote the damn bill.”

+
+
+ + +
+ +
+

Tim Ryan

+
+
+

“This plan that’s being offered by Senator Warren and Senator Sanders will tell those union members, who gave away wages in order to get good health care, that they will lose their health care because Washington is going to come in and tell them they have a better plan.”

+
+
+

The moderator asks Sanders if the benefits under “Medicare for All” will be as good as the ones the unions negotiated.

+
+
+

Bernie Sanders

+
+
+

“They will be better, because Medicare for All is comprehensive and covers all health care needs for senior citizens.”

+
+
+

Tim Ryan

+
+
+

“You don’t know that, Bernie.”

+
+
+

Bernie Sanders

+
+
+

“I do know it, I wrote the damn bill.”

+
+
+ + +
+ +
+

Tim Ryan

+
+
+

“This plan that’s being offered by Senator Warren and Senator Sanders will tell those union members, who gave away wages in order to get good health care, that they will lose their health care because Washington is going to come in and tell them they have a better plan.”

+
+
+

The moderator asks Sanders if the benefits under “Medicare for All” will be as good as the ones the unions negotiated.

+
+
+

Bernie Sanders

+
+
+

“They will be better, because Medicare for All is comprehensive and covers all health care needs for senior citizens.”

+
+
+

Tim Ryan

+
+
+

“You don’t know that, Bernie.”

+
+
+

Bernie Sanders

+
+
+

“I do know it, I wrote the damn bill.”

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

+ Immigration + Candidates Disagree on Whether Illegal Entry Should Be a Crime + +

+ + +

Some have argued that unauthorized border crossings should be a civil offense instead.

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

Elizabeth Warren

+
+
+

Other candidates weigh in.

+
+
+

“So the problem is that right now the criminalization statute is what gives Donald Trump the ability to take children away from their parents.”

+
+
+

Steve Bullock

+
+
+

Bernie Sanders

+
+
+

“We got a hundred thousand people showing up at the border right now. If we decriminalize entry, if we give health care to everyone, we’ll have multiples of that.”

+
+
+

“If a mother and a child walk thousands of miles on a dangerous path, in my view, they are not criminals.”

+
+
+ + +
+ +
+

Elizabeth Warren

+
+
+

“So the problem is that right now the criminalization statute is what gives Donald Trump the ability to take children away from their parents.”

+
+
+

Other candidates weigh in.

+
+
+

Steve Bullock

+
+
+

Bernie Sanders

+
+
+

“We got a hundred thousand people showing up at the border right now. If we decriminalize entry, if we give health care to everyone, we’ll have multiples of that.”

+
+
+

“If a mother and a child walk thousands of miles on a dangerous path, in my view, they are not criminals.”

+
+
+ + +
+ +
+

Elizabeth Warren

+
+
+

“So the problem is that right now the criminalization statute is what gives Donald Trump the ability to take children away from their parents.”

+
+
+

Other candidates weigh in.

+
+
+

Bernie Sanders

+
+
+

“If a mother and a child walk thousands of miles on a dangerous path, in my view, they are not criminals.”

+
+
+

Steve Bullock

+
+
+

“We got a hundred thousand people showing up at the border right now. If we decriminalize entry, if we give health care to everyone, we’ll have multiples of that.”

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

+ Party strategy + Delaney and Warren Pit Pragmatism Against Progressivism + +

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

John Delaney

+
+
+

“I think Democrats win when we run on real solutions, not impossible promises. When we run on things that are workable, not fairy tale economics.”

+
+
+

Elizabeth Warren

+
+
+

“I don’t understand why anybody goes to all the trouble of running for president of the United States just to talk about what we really can’t do and shouldn’t fight for.”

+
+
+ + +
+ +
+

John Delaney

+
+
+

“I think Democrats win when we run on real solutions, not impossible promises. When we run on things that are workable, not fairy tale economics.”

+
+
+

Elizabeth Warren

+
+
+

“I don’t understand why anybody goes to all the trouble of running for president of the United States just to talk about what we really can’t do and shouldn’t fight for.”

+
+
+ + +
+ +
+

John Delaney

+
+
+

“I think Democrats win when we run on real solutions, not impossible promises. When we run on things that are workable, not fairy tale economics.”

+
+
+

Elizabeth Warren

+
+
+

“I don’t understand why anybody goes to all the trouble of running for president of the United States just to talk about what we really can’t do and shouldn’t fight for.”

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

+ Here’s a preview of the matchups in Wednesday night’s debate » +

+ +
+ + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + +
+ +
+ + + + \ No newline at end of file diff --git a/data-raw/2019-07-31-us-elections-debate-speaking-time.html b/data-raw/2019-07-31-us-elections-debate-speaking-time.html new file mode 100644 index 0000000..c34da67 --- /dev/null +++ b/data-raw/2019-07-31-us-elections-debate-speaking-time.html @@ -0,0 +1,418 @@ + + + + Joe Biden and Kamala Harris Got the Most Speaking Time During the Democratic Debate - The New York Times + + + + + + + + + + + + + + + + + + + + + + + +

Joe Biden and Kamala Harris Got the Most Speaking Time During the Democratic Debate

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

+ + How Long Each Candidate Spoke + +

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

Health care

+
+ +
+ +

Immigration

+
+ +
+ +

Civil rights and race

+
+ +
+ +

Climate change

+
+ +
+ +

Economy

+
+ +
+ +

Women’s rights

+
+ +
+ +

Foreign policy

+
+ +
+ +

Party strategy

+
+ + + + +
+ + + + + + + + +
+ + +
+ +
+ +
+ + + + + + + + + + + + + + + + + + + + + +
+ + + Each bar segment represents the length of a candidate’s response to a question. +
+ + +
+ +

+ Former Vice President Joseph R. Biden Jr. and Senator Kamala Harris of California spoke the most during Wednesday night’s Democratic presidential debate. Senators Elizabeth Warren and Bernie Sanders got the most speaking time during Tuesday night’s debate. +

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

+ Get complete coverage of tonight’s debate » +

+ +
+ + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + +
+ +
+ + + + \ No newline at end of file diff --git a/data-raw/2019-09-12-us-elections-debate-speaking-time.html b/data-raw/2019-09-12-us-elections-debate-speaking-time.html new file mode 100644 index 0000000..ed17523 --- /dev/null +++ b/data-raw/2019-09-12-us-elections-debate-speaking-time.html @@ -0,0 +1,1181 @@ + + + + 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

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

+ + Each Time a Candidate Spoke + Each Time a Candidate Spoke on Each Topic + +

+ + + +

Candidates are sized by the length of time of each response.

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

Opening statements

+
+
+

Health care

+
+
+

Biden on Warren: “I know that the senator says

+

she’s for Bernie, well, I’m for Barack.”

+
+
+

Harris was the first candidate to directly attack Trump.

+
+
+

Civil rights and racism

+
+
+

Gun control

+
+
+

Castro began the first of several attacks against Biden:

+

“Are you forgetting already what you said just two minutes ago?”

+
+
+

Candidates praised O’Rourke for his response to the El Paso shooting.

+
+
+

“Racism in America is endemic. It is foundational.”

+
+
+

Trade

+
+
+

Immigration

+
+
+

Biden defended the Obama administration’s

+

immigration policies.

+
+
+

Foreign policy

+
+
+

Climate

+
+
+

Education

+
+
+

“I think I’m the only person on this stage who has been a public school teacher.”

+
+
+

“This is the existential crisis of our time.”

+
+
+

Candidates were asked about American troops in Afghanistan and the crisis in Venezuela.

+
+
+

Closing statements

+
+
+

Candidates were asked about their most significant professional setback.

+
+
+ + +
+
+ +
+

Opening statements

+
+
+

Harris was the first candidate to

+

directly attack Trump.

+
+
+

Health care

+
+
+

Biden on Warren: “I know that the senator says

+

she’s for Bernie, well, I’m for Barack.”

+
+
+

Castro began the first of several

+

attacks against Biden.

+
+
+

Civil rights and racism

+
+
+

“Racism in America is endemic. It is foundational.”

+
+
+

Gun control

+
+
+

Candidates praised O’Rourke for his response to the El Paso shooting.

+
+
+

Immigration

+
+
+

Biden defended the Obama administration’s

+

immigration policies.

+
+
+

Trade

+
+
+

Foreign policy

+
+
+

Candidates were asked about American troops in Afghanistan and the crisis in Venezuela.

+
+
+

Climate

+
+
+

“This is the existential crisis of our time.”

+
+
+

Education

+
+
+

“I think I’m the only person on this stage who has been a public school teacher.”

+
+
+

Closing statements

+
+
+

Candidates were asked about their most significant professional setback.

+
+
+ + +
+
+ +
+

Harris was the first candidate to directly attack Trump.

+
+
+

Opening statements

+
+
+

Biden on Warren: “I know that the senator says

+

she’s for Bernie, well, I’m for Barack.”

+
+
+

Health care

+
+
+

Civil rights and racism

+
+
+

“Racism in America is endemic.

+

It is foundational.”

+
+
+

Castro began the first of several

+

attacks against Biden.

+
+
+

Gun control

+
+
+

Candidates praised O’Rourke for his response to the El Paso shooting.

+
+
+

Immigration

+
+
+

Biden defended the Obama administration’s

+

immigration policies.

+
+
+

Trade

+
+
+

Foreign policy

+
+
+

Candidates were asked about American troops in Afghanistan and the crisis in Venezuela.

+
+
+

Climate

+
+
+

Education

+
+
+

“This is the existential crisis of our time.”

+
+
+

Closing statements

+
+
+

Candidates were asked about their most significant professional setback.

+
+
+

“I think I’m the only person on this stage who has been a public school teacher.”

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

+ Former Vice President Joseph R. Biden Jr. and Senator Elizabeth Warren of Massachusetts spoke the most during Thursday night’s Democratic presidential debate in Houston. Moderators were eager to showcase the contrasts between Mr. Biden and the progressive candidates, like Ms. Warren and Senator Bernie Sanders of Vermont. +

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

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

+ + + +

Each bar segment represents the length of a candidate’s response to a question.

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

Health care

+
+ +
+ +

Civil rights and racism

+
+ +
+ +

Gun control

+
+ +
+ +

Immigration

+
+ +
+ +

Trade

+
+ +
+ +

Foreign policy

+
+ +
+ +

Climate change

+
+ +
+ +

Education

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

+ Get full debate coverage from the New York Times here. +

+ +
+ + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + +
+ +
+ + + + \ No newline at end of file diff --git a/data-raw/debates2019.R b/data-raw/debates2019.R index 33340cb..48b2c82 100644 --- a/data-raw/debates2019.R +++ b/data-raw/debates2019.R @@ -1,14 +1,264 @@ ## code to prepare `debates2019` dataset goes here -read_csv( - file = "https://rud.is/data/2019-dem-debates.csv.gz", - col_types = cols( - elapsed = col_double(), - timestamp = col_time(format = ""), - speaker = col_character(), - topic = col_character() - ) -) -> debates2019 +# read_csv( +# file = "https://rud.is/data/2019-dem-debates.csv.gz", +# col_types = cols( +# elapsed = col_double(), +# timestamp = col_time(format = ""), +# speaker = col_character(), +# topic = col_character() +# ) +# ) -> debates2019 +# +# +# usethis::use_data(debates2019, overwrite = TRUE) +library(rvest) +library(stringi) +library(tidyverse) + +if (!file.exists(here::here("data-raw/2019-06-26-us-elections-debate-speaking-time.html"))) download.file("https://www.nytimes.com/interactive/2019/06/26/us/elections/debate-speaking-time.html", here::here("data-raw/2019-06-26-us-elections-debate-speaking-time.html")) +if (!file.exists(here::here("data-raw/2019-06-27-us-elections-debate-speaking-time.html"))) download.file("https://www.nytimes.com/interactive/2019/06/27/us/elections/debate-speaking-time.html", here::here("data-raw/2019-06-27-us-elections-debate-speaking-time.html")) +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")) + +read_html(here::here("data-raw/2019-06-26-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-09-13"), + speaker = stri_trans_totitle(speaker), + timestamp = parse_time(timestamp), + topic = stri_trans_totitle(topic), + debate_group = 1, + night = 1 + ) %>% + mutate( + speaker = case_when( + speaker == "Orourke" ~ "O'Rourke", + speaker == "Deblasio" ~ "de Blasio", + TRUE ~ speaker + ) + ) %>% + mutate( + topic = case_when( + topic == "" ~ "Other", + grepl("Campaign", topic) ~ "Campaign Finance Reform", + grepl("Civil", topic) ~ "Civil Rights", + grepl("Climate", topic) ~ "Climate", + grepl("Foreign", topic) ~ "Foreign Policy", + grepl("Gun", topic) ~ "Gun Control", + grepl("Election", topic) ~ "Elections Reform", + grepl("Health", topic) ~ "Healthcare", + grepl("Party", topic) ~ "Party Strategy", + grepl("Women", topic) ~ "Womens Rights", + TRUE ~ topic + ) + ) %>% + filter( + !is.na(timestamp), + speaker != "", + speaker != "Moderator" + ) %>% + as_tibble() -> jun_day_1 + +read_html(here::here("data-raw/2019-06-27-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-09-13"), + speaker = stri_trans_totitle(speaker), + timestamp = parse_time(timestamp), + topic = stri_trans_totitle(topic), + debate_group = 1, + night = 2 + ) %>% + mutate( + speaker = case_when( + speaker == "Orourke" ~ "O'Rourke", + speaker == "Deblasio" ~ "de Blasio", + TRUE ~ speaker + ) + ) %>% + mutate( + topic = case_when( + topic == "" ~ "Other", + grepl("Campaign", topic) ~ "Campaign Finance Reform", + grepl("Civil", topic) ~ "Civil Rights", + grepl("Climate", topic) ~ "Climate", + grepl("Foreign", topic) ~ "Foreign Policy", + grepl("Gun", topic) ~ "Gun Control", + grepl("Election", topic) ~ "Elections Reform", + grepl("Health", topic) ~ "Healthcare", + grepl("Party", topic) ~ "Party Strategy", + grepl("Women", topic) ~ "Womens Rights", + TRUE ~ topic + ) + ) %>% + filter( + !is.na(timestamp), + speaker != "", + speaker != "Moderator" + ) %>% + as_tibble() -> jun_day_2 + +read_html(here::here("data-raw/2019-07-30-us-elections-debate-speaking-time.html")) %>% + html_nodes(xpath = ".//script[contains(., 'NYTG_DEMDEBATES')]") %>% + html_text() %>% + stri_split_lines() %>% + unlist() %>% + .[2] %>% + stri_replace_first_regex("^.*NYTG_DEMDEBATES = ", "") %>% + jsonlite::fromJSON() %>% + mutate( + elapsed = as.numeric(elapsed)/60, + debate_date = as.Date("2019-09-13"), + speaker = stri_trans_totitle(speaker), + timestamp = parse_time(timestamp), + topic = stri_trans_totitle(topic), + debate_group = 2, + night = 1 + ) %>% + mutate( + speaker = case_when( + speaker == "Orourke" ~ "O'Rourke", + speaker == "Deblasio" ~ "de Blasio", + TRUE ~ speaker + ) + ) %>% + mutate( + topic = case_when( + topic == "" ~ "Other", + grepl("Campaign", topic) ~ "Campaign Finance Reform", + grepl("Civil", topic) ~ "Civil Rights", + grepl("Climate", topic) ~ "Climate", + grepl("Foreign", topic) ~ "Foreign Policy", + grepl("Gun", topic) ~ "Gun Control", + grepl("Election", topic) ~ "Elections Reform", + grepl("Health", topic) ~ "Healthcare", + grepl("Party", topic) ~ "Party Strategy", + grepl("Women", topic) ~ "Womens Rights", + TRUE ~ topic + ) + ) %>% + filter( + !is.na(timestamp), + speaker != "", + speaker != "Moderator" + ) %>% + as_tibble() -> jul_day_1 +read_html(here::here("data-raw/2019-07-31-us-elections-debate-speaking-time.html")) %>% + html_nodes(xpath = ".//script[contains(., 'NYTG_DEMDEBATES')]") %>% + html_text() %>% + stri_split_lines() %>% + unlist() %>% + .[2] %>% + stri_replace_first_regex("^.*NYTG_DEMDEBATES = ", "") %>% + jsonlite::fromJSON() %>% + mutate( + elapsed = as.numeric(elapsed)/60, + debate_date = as.Date("2019-09-13"), + speaker = stri_trans_totitle(speaker), + timestamp = parse_time(timestamp), + topic = stri_trans_totitle(topic), + debate_group = 2, + night = 2 + ) %>% + mutate( + speaker = case_when( + speaker == "Orourke" ~ "O'Rourke", + speaker == "Deblasio" ~ "de Blasio", + TRUE ~ speaker + ) + ) %>% + mutate( + topic = case_when( + topic == "" ~ "Other", + grepl("Campaign", topic) ~ "Campaign Finance Reform", + grepl("Civil", topic) ~ "Civil Rights", + grepl("Climate", topic) ~ "Climate", + grepl("Foreign", topic) ~ "Foreign Policy", + grepl("Gun", topic) ~ "Gun Control", + grepl("Election", topic) ~ "Elections Reform", + grepl("Health", topic) ~ "Healthcare", + grepl("Party", topic) ~ "Party Strategy", + grepl("Women", topic) ~ "Womens Rights", + TRUE ~ topic + ) + ) %>% + filter( + !is.na(timestamp), + speaker != "", + speaker != "Moderator" + ) %>% + as_tibble() -> jul_day_2 + +read_html(here::here("data-raw/2019-09-12-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-09-13"), + speaker = stri_trans_totitle(speaker), + timestamp = parse_time(timestamp), + topic = stri_trans_totitle(topic), + debate_group = 3, + night = 1 + ) %>% + mutate( + speaker = case_when( + speaker == "Orourke" ~ "O'Rourke", + speaker == "Deblasio" ~ "de Blasio", + TRUE ~ speaker + ) + ) %>% + mutate( + topic = case_when( + topic == "" ~ "Other", + grepl("Campaign", topic) ~ "Campaign Finance Reform", + grepl("Civil", topic) ~ "Civil Rights", + grepl("Climate", topic) ~ "Climate", + grepl("Foreign", topic) ~ "Foreign Policy", + grepl("Gun", topic) ~ "Gun Control", + grepl("Election", topic) ~ "Elections Reform", + grepl("Health", topic) ~ "Healthcare", + grepl("Party", topic) ~ "Party Strategy", + grepl("Women", topic) ~ "Womens Rights", + TRUE ~ topic + ) + ) %>% + filter( + !is.na(timestamp), + speaker != "", + speaker != "Moderator" + ) %>% + as_tibble() -> sep_day_1 + +bind_rows( + jun_day_1, + jun_day_2, + jul_day_1, + jul_day_2, + sep_day_1 +) -> debates2019 usethis::use_data(debates2019, overwrite = TRUE) + diff --git a/data/debates2019.rda b/data/debates2019.rda index 89ef7fa..1d09a97 100644 Binary files a/data/debates2019.rda and b/data/debates2019.rda differ diff --git a/man/debates2019.Rd b/man/debates2019.Rd index 2253609..6137e43 100644 --- a/man/debates2019.Rd +++ b/man/debates2019.Rd @@ -3,8 +3,9 @@ \docType{data} \name{debates2019} \alias{debates2019} -\title{June 2019 U.S. Democratic Debate Candidate/Topic Times} -\format{data frame with columns: \code{elapsed} (dbl), \code{timestamp} (drtn), \code{speaker} (chr), \code{topic} (chr)} +\title{2019-2020 U.S. Democratic Debate Candidate/Topic Times} +\format{data frame with columns: \code{elapsed} (dbl), \code{timestamp} (time), \code{speaker} (chr), \code{topic} (chr) +\code{debate_date} (date), \code{debate_group} (dbl), \code{night} (dbl)} \usage{ data("debates2019") } @@ -16,8 +17,14 @@ topic times. The complete datasets (See References) also include moderator metadata and opening/closing statement records. } \references{ -\url{https://www.nytimes.com/interactive/2019/admin/100000006581096.embedded.html} +\url{https://www.nytimes.com/interactive/2019/06/26/us/elections/debate-speaking-time.html} -\url{https://www.nytimes.com/interactive/2019/admin/100000006584572.embedded.html} +\url{https://www.nytimes.com/interactive/2019/06/27/us/elections/debate-speaking-time.html} + +\url{https://www.nytimes.com/interactive/2019/07/30/us/elections/debate-speaking-time.html} + +\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} } \keyword{datasets} diff --git a/man/figures/README-nyt-1.png b/man/figures/README-nyt-1.png index b74f871..627e5f9 100644 Binary files a/man/figures/README-nyt-1.png and b/man/figures/README-nyt-1.png differ diff --git a/vignettes/using-ggchicklet.Rmd b/vignettes/using-ggchicklet.Rmd index 92518cb..5935834 100644 --- a/vignettes/using-ggchicklet.Rmd +++ b/vignettes/using-ggchicklet.Rmd @@ -51,7 +51,10 @@ The `elapsed` column contains how long the candidate spoke and `timestamp` is th There are also candidates: ```{r data-ex-01} -distinct(debates2019, speaker) %>% +debates2019 %>% + filter(debate_group == 1) %>% + filter(night == 1) %>% + distinct(speaker) %>% arrange(speaker) %>% print(n=nrow(.)) ``` @@ -59,7 +62,10 @@ distinct(debates2019, speaker) %>% and the topics debates: ```{r data-ex-02} -distinct(debates2019, topic) %>% +debates2019 %>% + filter(debate_group == 1) %>% + filter(night == 1) %>% + distinct(topic) %>% arrange(topic) %>% print(n=nrow(.)) ``` @@ -76,6 +82,7 @@ the segments by topic. ```{r chicklet, fig.width=600/72, fig.height=600/72} debates2019 %>% + filter(debate_group == 1) %>% mutate(speaker = fct_reorder(speaker, elapsed, sum, .desc=FALSE)) %>% mutate(topic = fct_other( topic,