diff --git a/NEWS.md b/NEWS.md index c0841ec..49dff4d 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,3 +1,6 @@ +0.5.1 +* Data updated for latest debate (2020-02-19) + 0.5.0 * Data updated for latest debate (2020-02-07) diff --git a/data-raw/2020-02-07-us-elections-debate-speaking-time.html b/data-raw/2020-02-07-us-elections-debate-speaking-time.html index a40c59e..6e316e7 100644 --- a/data-raw/2020-02-07-us-elections-debate-speaking-time.html +++ b/data-raw/2020-02-07-us-elections-debate-speaking-time.html @@ -1,27 +1,28 @@ - + Which Candidates Got the Most Speaking Time in the Democratic Debate - The New York Times - + - + - + - - - + + + @@ -90,7 +90,7 @@ var NYTD=NYTD||{};NYTD.Abra=function(t){"use strict";function e(t){var e=r[t];re pageType: 'int', pageViewId: window.NYTD.PageViewId.current, }); - (function () { var _f=function(e){var o=performance.navigation&&1===performance.navigation.type;function n(){return window.matchMedia("(max-width: 739px)").matches}function t(e){var t,r,i,d,a,p,s=function(){var e=window.userXhrObject&&""!==window.userXhrObject.responseText&&JSON.parse(window.userXhrObject.responseText).data||null,o=null;return e&&e.user&&e.user.userInfo&&(o=e.user.userInfo.demographics),o}();return s?(r=e,d=(t=s)&&t.emailSubscriptions,(a=t&&t.bundleSubscriptions)&&r&&(r.sub="reg",d&&d.length&&(r.em=d.toString().toLowerCase()),t.wat&&(r.wat=t.wat.toLowerCase()),a&&a.length&&a[0].bundle&&(i=a[0],r.sub=i.bundle.toLowerCase(),i.source&&(r.subsrc=i.source.toLowerCase()),i.promotion&&(r.subprm=i.promotion),i.in_grace&&(r.grace=i.in_grace.toString()))),e=r):e.sub="anon",n()?(e.prop="mnyt",e.plat="mweb",e.ver="mvi"):(e.prop="nyt",e.plat="web",e.ver="vi"),"/es/"===window.location.pathname.substring(0,4)&&(e.prop="esnyt",e.edn="es",n()&&(e.prop="mesnyt")),"hp"===e.typ&&(document.referrer&&(e.topref=document.referrer),o&&(e.refresh="manual")),e.abra_dfp=(p=document.documentElement.getAttribute("data-nyt-ab"))?p.split(" ").reduce(function(e,o){var n=o.split("="),t=n[0].toLowerCase(),r=n[1];return(t.indexOf("dfp")>-1||t.indexOf("redbird")>-1)&&e.push(t+"_"+r),e},[]):"",e.page_view_id=window.NYTD.PageViewId&&window.NYTD.PageViewId.current,e.sov=function(){const e=(Math.floor(4*Math.random())+1).toString();return window.sov?window.sov:(window.sov=e,window.sov)}(),e}var r=e||{},i=r.adTargeting||{},d=r.adUnitPath||"/29390238/nyt/homepage",a=r.offset||400,p=r.hideTopAd||n(),s=r.lockdownAds||!1,u=r.sizeMapping||{top:[[970,["fluid",[728,90],[970,90],[970,250],[1605,300]]],[728,["fluid",[728,90],[1605,300]]],[0,["fluid",[300,250],[300,420]]]],fp1:[[0,[195,250]]],fp2:[[0,[195,250]]],fp3:[[0,[195,250]]],interstitial:[[0,[[1,1],[640,480]]]],mktg:[[1020,[300,250]],[0,[]]],pencil:[[728,[[336,46]],[0,[]]]],pp_edpick:[[0,["fluid"]]],pp_morein:[[0,["fluid"],[210,218]]],ribbon:[[0,["fluid"]]],sponsor:[[765,[150,50]],[0,[320,25]]],supplemental:[[1020,[[300,250],[300,600]]],[0,[]]],chat:[[0,["fluid",[300,250],[300,420]]]],column:[[0,["fluid",[300,250],[300,420]]]],default:[[970,["fluid",[728,90],[970,90],[970,250],[1605,300]]],[728,["fluid",[728,90],[300,250],[1605,300]]],[0,["fluid",[300,250],[300,420]]]]},w=r.dfpToggleName||"dfp_home_toggle",l=r.lazyApi||{};window.AdSlot4=window.AdSlot4||{},window.AdSlot4.cmd=window.AdSlot4.cmd||[],window.AdSlot4.cmd.push(function(){var e,o,n;window.AdSlot4.init({adTargeting:t(i),adUnitPath:d,sizeMapping:u,offset:a,haltDFP:"1_block"===window.NYTD.Abra(w),hideTopAd:p,lockdownAds:s,lazyApi:(e=l,o=e&&e.fetch&&e.render?e:{},n=window.NYTD&&window.NYTD.Abra&&window.NYTD.Abra("dfp_lazy5"),n&&e[n]&&(o=e[n],window.NYTD.Abra.reportExposure("dfp_lazy5")),o)}),window.NYTD.Abra.reportExposure("dfp_adslot4v2")})};;_f.apply(null, [{"adTargeting":{"vp":"small","als_test":"1581194749898","prop":"mnyt","plat":"mweb","edn":"us","brandsensitive":"false","per":"buttigiegpete1982,sandersbernard","org":"democraticparty","des":"presidentialelectionof2020,debatespolitical,politicsandgovernment,elections","auth":"quoctrungbui,sarahalmukhtar,weiyicai","coll":"election2020,usnews","artlen":"short","ledemedsz":"none","template":"interactive","typ":"int","section":"us","si_section":"us","id":"100000006964908","pt":"nt11,nt13,nt17,nt5,nt7,pt12,pt15,pt2,pt6","gscat":"neg_google,gs_politics,gs_politics_misc,gs_politics_american,neg_ibmtest,neg_ibm,neg_mastercard,neg_bofa,neg_bp,gs_health,neg_hearts,neg_capitalone,neg_msft,neg_korean_air,neg_captialone_p1,gs_science,gs_law_misc,neg_fcli,neg_orep,gv_safe,gs_t","mt":"MT5","ver":"mvi","sov":"3","sub":"anon","test":"projectvi","ref":"","refdom":"","abra_dfp":"","gpt-beta":"vqwdtftx"},"adUnitPath":"/29390238/nyt/us/politics/elections"}]); })(); + (function () { var _f=function(e){var o=performance.navigation&&1===performance.navigation.type;function n(){return window.matchMedia("(max-width: 739px)").matches}function r(e){var r,i,t,d,a,w,p=function(){var e=window.userXhrObject&&""!==window.userXhrObject.responseText&&JSON.parse(window.userXhrObject.responseText).data||null,o=null;return e&&e.user&&e.user.userInfo&&(o=e.user.userInfo.demographics),o}();return p?(i=e,d=(r=p)&&r.emailSubscriptions,(a=r&&r.bundleSubscriptions)&&i&&(i.sub="reg",d&&d.length&&(i.em=d.toString().toLowerCase()),r.wat&&(i.wat=r.wat.toLowerCase()),a&&a.length&&a[0].bundle&&(t=a[0],i.sub=t.bundle.toLowerCase(),t.source&&(i.subsrc=t.source.toLowerCase()),t.promotion&&(i.subprm=t.promotion),t.in_grace&&(i.grace=t.in_grace.toString()))),e=i):e.sub="anon",n()?(e.prop="mnyt",e.plat="mweb",e.ver="mvi"):(e.prop="nyt",e.plat="web",e.ver="vi"),"/es/"===window.location.pathname.substring(0,4)&&(e.prop="esnyt",e.edn="es",n()&&(e.prop="mesnyt")),"hp"===e.typ&&(document.referrer&&(e.topref=document.referrer),o&&(e.refresh="manual")),e.abra_dfp=(w=window.NYTD&&window.NYTD.Abra)&&w.config?Object.keys(w.config).reduce(function(e,o){const n=o.toLowerCase(),r=w.getAbraSync&&w.getAbraSync(o)||{};if((n.indexOf("dfp")>-1||o.indexOf("redbird")>-1)&&r.variant){var i=n+"_"+r.variant.toLowerCase();e.push(i)}return e},[]):"",e.page_view_id=window.NYTD.PageViewId&&window.NYTD.PageViewId.current,e.sov=function(){const e=(Math.floor(4*Math.random())+1).toString();return window.sov?window.sov:(window.sov=e,window.sov)}(),e}var i=e||{},t=i.adTargeting||{},d=i.adUnitPath||"/29390238/nyt/homepage",a=i.offset||400,w=i.hideTopAd||n(),p=i.lockdownAds||!1,s=i.sizeMapping||{top:[[970,["fluid",[728,90],[970,90],[970,250],[1605,300]]],[728,["fluid",[728,90],[1605,300]]],[0,["fluid",[300,250],[300,420]]]],fp1:[[0,[195,250]]],fp2:[[0,[195,250]]],fp3:[[0,[195,250]]],interstitial:[[0,[[1,1],[640,480]]]],mktg:[[1020,[300,250]],[0,[]]],pencil:[[728,[[336,46]],[0,[]]]],pp_edpick:[[0,["fluid"]]],pp_morein:[[0,["fluid"],[210,218]]],ribbon:[[0,["fluid"]]],sponsor:[[765,[150,50]],[0,[320,25]]],supplemental:[[1020,[[300,250],[300,600]]],[0,[]]],chat:[[0,["fluid",[300,250],[300,420]]]],column:[[0,["fluid",[300,250],[300,420]]]],default:[[970,["fluid",[728,90],[970,90],[970,250],[1605,300]]],[728,["fluid",[728,90],[300,250],[1605,300]]],[0,["fluid",[300,250],[300,420]]]]},u=i.dfpToggleName||"dfp_home_toggle",l=i.lazyApi||{};window.AdSlot4=window.AdSlot4||{},window.AdSlot4.cmd=window.AdSlot4.cmd||[],window.AdSlot4.cmd.push(function(){var e,o,n;window.AdSlot4.init({adTargeting:r(t),adUnitPath:d,sizeMapping:s,offset:a,haltDFP:"1_block"===window.NYTD.Abra(u),hideTopAd:w,lockdownAds:p,lazyApi:(e=l,o=e&&e.fetch&&e.render?e:{},n=window.NYTD&&window.NYTD.Abra&&window.NYTD.Abra("dfp_lazy5"),n&&e[n]&&(o=e[n],window.NYTD.Abra.reportExposure("dfp_lazy5")),o)}),window.NYTD.Abra.reportExposure("dfp_adslot4v2")})};;_f.apply(null, [{"adTargeting":{"vp":"small","als_test":"1582203539293","prop":"mnyt","plat":"mweb","edn":"us","brandsensitive":"false","per":"buttigiegpete1982,sandersbernard","org":"democraticparty","des":"presidentialelectionof2020,debatespolitical,politicsandgovernment,elections","auth":"quoctrungbui,sarahalmukhtar,weiyicai","coll":"election2020,usnews","artlen":"short","ledemedsz":"none","template":"interactive","typ":"int","section":"us","si_section":"us","id":"100000006964908","pt":"nt11,nt13,nt17,nt5,pt12,pt15,pt2,pt6","gscat":"neg_google,gs_politics,gs_politics_misc,gs_politics_american,neg_ibmtest,neg_ibm,neg_mastercard,neg_bofa,neg_bp,gs_health,neg_hearts,neg_capitalone,neg_msft,neg_korean_air,neg_captialone_p1,gs_science,gs_law_misc,neg_fcli,neg_orep,gv_safe,gs_t","mt":"MT5","ver":"mvi","sov":"4","sub":"anon","test":"projectvi","ref":"","refdom":"","abra_dfp":"","gpt-beta":"vqwdtftx"},"adUnitPath":"/29390238/nyt/us/politics/elections"}]); })(); - + + - + - + \ No newline at end of file diff --git a/data-raw/2020-02-19-us-elections-debate-speaking-time.html b/data-raw/2020-02-19-us-elections-debate-speaking-time.html new file mode 100644 index 0000000..c21084d --- /dev/null +++ b/data-raw/2020-02-19-us-elections-debate-speaking-time.html @@ -0,0 +1,615 @@ + + + + Which Candidates Got the Most Speaking Time in the Democratic Debate - The New York Times + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Advertisement

Which Candidates Got the Most Speaking Time in the Democratic Debate

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

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

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

Electability

+
+ +
+ +

Health care

+
+ +
+ +

Criminal justice

+
+ +
+ +

Transparency

+
+ +
+ +

Foreign policy

+
+ +
+ +

Sexism

+
+ +
+ +

Climate

+
+ +
+ +

Economic inequality

+
+ +
+ +

Immigration

+
+ +
+ +

Party loyalty

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

+ Senators Elizabeth Warren of Massachusetts and Amy Klobuchar of Minnesota had the most speaking time of the six Democratic presidential candidates in the debate in Las Vegas, three days ahead of the Nevada caucuses on Saturday. This was the first debate in which two female candidates led the stage. +

+

+ Former Mayor Michael Bloomberg of New York, making his first appearance in a presidential debate, came under fire from the other candidates for his past comments on women, stop-and-frisk policies and failure to release his tax returns. Mr. Bloomberg said he would release his tax returns soon. +

+

+ The debate was far more heated than previous debates, with the candidates frequently interrupting each other and demanding time to respond to attacks. +

+ + + + + + + + + + + + +
+ + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + + + + + + + + + + +
+ + + Note: The size of each circle represents the total length of a candidate’s responses to a topic. +
+ + +
+ +

+ The candidates also discussed their plans to deal with environmental issues. While all said they were resolved to fight climate change, they differed in their stances on whether fracking should be banned completely. +

+

+ When Senator Bernie Sanders of Vermont was asked if he stood by his comments about whether billionaires should exist, he called it wrong and immoral for Mr. Bloomberg to own more wealth than the bottom 125 million Americans. Mr. Bloomberg, a multibillionaire, said he worked hard to earn his money and would be “giving it all away to make this country better.” +

+

+ The debate ended with the question of whether the Democratic candidate with the most pledged delegates should be the party’s nominee, regardless of whether he or she has a majority required. Only Mr. Sanders agreed. +

+

+ Get full coverage of the Democratic presidential debate from The Times. +

+ +
+ + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + +
+ +
+ + + + + \ No newline at end of file diff --git a/data-raw/debates2019.R b/data-raw/debates2019.R index 8108129..dd81d54 100644 --- a/data-raw/debates2019.R +++ b/data-raw/debates2019.R @@ -25,7 +25,8 @@ if (!file.exists(here::here("data-raw/2019-10-15-us-elections-debate-speaking-ti if (!file.exists(here::here("data-raw/2019-11-20-us-elections-debate-speaking-time.html"))) download.file("https://www.nytimes.com/interactive/2019/11/20/us/elections/debate-speaking-time.html", here::here("data-raw/2019-11-20-us-elections-debate-speaking-time.html")) if (!file.exists(here::here("data-raw/2019-12-19-us-elections-debate-speaking-time.html"))) download.file("https://www.nytimes.com/interactive/2019/12/19/us/elections/debate-speaking-time.html", here::here("data-raw/2019-12-19-us-elections-debate-speaking-time.html")) if (!file.exists(here::here("data-raw/2020-01-14-us-elections-debate-speaking-time.html"))) download.file("https://www.nytimes.com/interactive/2020/01/14/us/politics/debate-speaking-time.html", here::here("data-raw/2020-01-14-us-elections-debate-speaking-time.html")) -if (!file.exists(here::here("data-raw/2020-02-08-us-elections-debate-speaking-time.html"))) download.file("https://www.nytimes.com/interactive/2020/02/07/us/elections/debate-speaking-time.html", here::here("data-raw/2020-02-07-us-elections-debate-speaking-time.html")) +if (!file.exists(here::here("data-raw/2020-02-07-us-elections-debate-speaking-time.html"))) download.file("https://www.nytimes.com/interactive/2020/02/07/us/elections/debate-speaking-time.html", here::here("data-raw/2020-02-07-us-elections-debate-speaking-time.html")) +if (!file.exists(here::here("data-raw/2020-02-19-us-elections-debate-speaking-time.html"))) download.file("https://www.nytimes.com/interactive/2020/02/19/us/elections/debate-speaking-time.html", here::here("data-raw/2020-02-19-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')]") %>% @@ -337,6 +338,7 @@ read_html(here::here("data-raw/2019-11-20-us-elections-debate-speaking-time.html grepl("immigration", topic) ~ "Immigration", grepl("impeachment", topic) ~ "Impeachment", grepl("income-inequality", topic) ~ "Income Inequality", + grepl("economic-inequality", topic) ~ "Income Inequality", grepl("economy", topic) ~ "Economy", grepl("middle-east policy", topic) ~ "Foreign Policy", grepl("opioids", topic) ~ "Opioids", @@ -380,7 +382,9 @@ read_html(here::here("data-raw/2019-12-19-us-elections-debate-speaking-time.html grepl("climate", topic) ~ "Climate", grepl("closing", topic) ~ "Closing", grepl("judges", topic) ~ "Judges", + grepl("transparency", topic) ~ "Transparency", grepl("race", topic) ~ "Race", + grepl("economic-inequality", topic) ~ "Income Inequality", grepl("education", topic) ~ "Education", grepl("human-rights", topic) ~ "Human Rights", grepl("criminal-justice", topic) ~ "Criminal Justice", @@ -489,7 +493,7 @@ read_html(here::here("data-raw/2020-02-07-us-elections-debate-speaking-time.html debate_date = as.Date("2020-01-14"), speaker = stri_trans_totitle(speaker), timestamp = parse_time(timestamp), - debate_group = 7, + debate_group = 8, night = 1 ) %>% filter(speaker != "") %>% @@ -541,6 +545,79 @@ read_html(here::here("data-raw/2020-02-07-us-elections-debate-speaking-time.html ) %>% as_tibble() -> feb_07_day_1 + +read_html(here::here("data-raw/2020-02-19-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() %>% + as_tibble() %>% + mutate( + elapsed = as.numeric(elapsed)/60, + debate_date = as.Date("2020-01-14"), + speaker = stri_trans_totitle(speaker), + timestamp = parse_time(timestamp), + debate_group = 9, + night = 1 + ) %>% + filter(speaker != "") %>% + filter(!is.na(timestamp)) %>% + # distinct(topic) %>% + # print(n=nrow(.)) + mutate( + topic = case_when( + topic == "" ~ "Other", + grepl("military", topic) ~ "Military", + grepl("climate", topic) ~ "Climate", + grepl("closing", topic) ~ "Closing", + grepl("judges", topic) ~ "Judges", + grepl("race", topic) ~ "Race", + grepl("Climate-change", topic) ~ "Climate", + grepl("poverty", topic) ~ "Poverty", + grepl("education", topic) ~ "Education", + grepl("bloomberg", topic) ~ "Bloomberg", + grepl("human-rights", topic) ~ "Human Rights", + grepl("criminal-justice", topic) ~ "Criminal Justice", + grepl("electability", topic) ~ "Electability", + grepl("election-reform", topic) ~ "Election Reform", + grepl("executive-power", topic) ~ "Executive Power", + grepl("candidate-age", topic) ~ "Age", + grepl("supreme-court", topic) ~ "Supreme Court", + grepl("foreign-policy", topic) ~ "Foreign Policy", + grepl("gun-control", topic) ~ "Gun Control", + grepl("child-care", topic) ~ "Child Care", + grepl("party-loyalty", topic) ~ "Party Loyalty", + grepl("health-care", topic) ~ "Healthcare", + grepl("immigration", topic) ~ "Immigration", + grepl("impeachment", topic) ~ "Impeachment", + grepl("economic-inequality", topic) ~ "Income Inequality", + grepl("income-inequality", topic) ~ "Income Inequality", + grepl("female-president", topic) ~ "Female President", + grepl("trade", topic) ~ "Trade", + grepl("economy", topic) ~ "Economy", + grepl("sexism", topic) ~ "Sexism", + grepl("middle-east policy", topic) ~ "Foreign Policy", + grepl("opioids", topic) ~ "Opioids", + grepl("party-strategy", topic) ~ "Party Strategy", + grepl("public-service", topic) ~ "Public Service", + grepl("tech-companies", topic) ~ "Tech Companies", + grepl("white-supremacist violence", topic) ~ "White-Supremacy", + grepl("womens-issues", topic) ~ "Women's Rights", + topic == "" ~ "Other", + TRUE ~ topic + ) + ) %>% + filter( + !is.na(timestamp), + speaker != "", + speaker != "Moderator" + ) %>% + as_tibble() -> feb_19_day_1 + + bind_rows( jun_day_1, jun_day_2, @@ -551,7 +628,8 @@ bind_rows( nov_day_1, dec_day_1, jan_20_day_1, - feb_07_day_1 + feb_07_day_1, + feb_19_day_1 ) %>% mutate(topic = case_when( grepl("elect.*form", topic, ignore.case = TRUE) ~ "Election Reform", diff --git a/data/debates2019.rda b/data/debates2019.rda index ba79f91..fa32c52 100644 Binary files a/data/debates2019.rda and b/data/debates2019.rda differ