We learn reading web data into R. As cosmopolitan political scientists, we want to learn something about US politics from The Presidency Project of UC Santa Barbara. Visit the page and search for a keyword or president you are interested in. Then, copy the URL and assign it to a new object.
browseURL("https://www.presidency.ucsb.edu/")
Now, let’s try to scrape this page
library()
command.read_html()
on the url object you just created - assign the result to a new objectlibrary(dplyr)
##
## Attaching package: 'dplyr'
## The following objects are masked from 'package:stats':
##
## filter, lag
## The following objects are masked from 'package:base':
##
## intersect, setdiff, setequal, union
library(rvest)
## Warning: package 'rvest' was built under R version 4.1.3
url <- "https://www.presidency.ucsb.edu/advanced-search?field-keywords=crisis&items_per_page=25"
searchresults <- read_html(url)
searchresults
## {html_document}
## <html lang="en" dir="ltr" prefix="content: http://purl.org/rss/1.0/modules/content/ dc: http://purl.org/dc/terms/ foaf: http://xmlns.com/foaf/0.1/ og: http://ogp.me/ns# rdfs: http://www.w3.org/2000/01/rdf-schema# sioc: http://rdfs.org/sioc/ns# sioct: http://rdfs.org/sioc/types# skos: http://www.w3.org/2004/02/skos/core# xsd: http://www.w3.org/2001/XMLSchema#">
## [1] <head profile="http://www.w3.org/1999/xhtml/vocab">\n<meta charset="utf-8 ...
## [2] <body class="html not-front not-logged-in one-sidebar sidebar-first page- ...
We start with something satisfying: Out of the box, rvest
converts tables into a list of data frames when calling html_table()
on a page. Use this on the webpage you parsed.
html_table(searchresults)
## [[1]]
## # A tibble: 25 x 3
## Date Related `Document Title`
## <chr> <chr> <chr>
## 1 Apr 30, 1789 George Washington Inaugural Addressarising out of the present c~
## 2 May 18, 1789 George Washington Message in Reply to the Senatewhich led to th~
## 3 Mar 23, 1792 George Washington Special MessageFive Nations and the present c~
## 4 Nov 19, 1794 George Washington Sixth Annual Address to Congresswhat might be~
## 5 Nov 29, 1794 George Washington Message in Reply to the House of Representati~
## 6 Mar 04, 1797 John Adams Inaugural Addresscalamity. In this dangerous ~
## 7 May 16, 1797 John Adams Address to a Joint Session of Congress on Rel~
## 8 Jun 03, 1797 John Adams Message in Reply to the House of Representati~
## 9 Jul 13, 1798 John Adams Letter to John Adams from George Washingtonfu~
## 10 Dec 10, 1799 John Adams Message in Reply to the House of Representati~
## # ... with 15 more rows
If you assign the result to an object, the object will be a list. You can extract specific tables from this list by subsetting the list (that is, putting the number of the table you want in two squared brackets). Or, if you want to proceed in a piping-chain, you can use the command extract2()
from the magrittr
package, adding the number of the table in brackets (the command name is no typo - extract
without the 2 works for vectors, extract2()
works for lists).
Try both variants for extracting the results table.
tables <- html_table(searchresults)
tables [[1]]
## # A tibble: 25 x 3
## Date Related `Document Title`
## <chr> <chr> <chr>
## 1 Apr 30, 1789 George Washington Inaugural Addressarising out of the present c~
## 2 May 18, 1789 George Washington Message in Reply to the Senatewhich led to th~
## 3 Mar 23, 1792 George Washington Special MessageFive Nations and the present c~
## 4 Nov 19, 1794 George Washington Sixth Annual Address to Congresswhat might be~
## 5 Nov 29, 1794 George Washington Message in Reply to the House of Representati~
## 6 Mar 04, 1797 John Adams Inaugural Addresscalamity. In this dangerous ~
## 7 May 16, 1797 John Adams Address to a Joint Session of Congress on Rel~
## 8 Jun 03, 1797 John Adams Message in Reply to the House of Representati~
## 9 Jul 13, 1798 John Adams Letter to John Adams from George Washingtonfu~
## 10 Dec 10, 1799 John Adams Message in Reply to the House of Representati~
## # ... with 15 more rows
library(magrittr)
extract2(tables, 1)
## # A tibble: 25 x 3
## Date Related `Document Title`
## <chr> <chr> <chr>
## 1 Apr 30, 1789 George Washington Inaugural Addressarising out of the present c~
## 2 May 18, 1789 George Washington Message in Reply to the Senatewhich led to th~
## 3 Mar 23, 1792 George Washington Special MessageFive Nations and the present c~
## 4 Nov 19, 1794 George Washington Sixth Annual Address to Congresswhat might be~
## 5 Nov 29, 1794 George Washington Message in Reply to the House of Representati~
## 6 Mar 04, 1797 John Adams Inaugural Addresscalamity. In this dangerous ~
## 7 May 16, 1797 John Adams Address to a Joint Session of Congress on Rel~
## 8 Jun 03, 1797 John Adams Message in Reply to the House of Representati~
## 9 Jul 13, 1798 John Adams Letter to John Adams from George Washingtonfu~
## 10 Dec 10, 1799 John Adams Message in Reply to the House of Representati~
## # ... with 15 more rows
Check this list of Eiffel Tower replicas and derivatives. Scrape the table and count which country has the most Eiffel tower replicas.
page <- read_html("https://en.wikipedia.org/wiki/Eiffel_Tower_replicas_and_derivatives")
table <- html_table(page) %>%
extract2(1)
table %>%
group_by(Country) %>%
tally() %>%
arrange(desc(n))
## # A tibble: 34 x 2
## Country n
## <chr> <int>
## 1 United States 11
## 2 Russia 6
## 3 Japan 4
## 4 China 3
## 5 Ukraine 3
## 6 Australia 2
## 7 Brazil 2
## 8 Germany 2
## 9 Iran 2
## 10 United Kingdom 2
## # ... with 24 more rows
The Watergate scandal still shapes how we think of political scandals today and has become an inspiration for the names of many other scandals.
Visit the list of scandals that end with ‘gate’. Scrape the table that contains scandals from the domain of politics. Plot the distribution of these scandals over time - which year was a high point in political scandals ending in -gate?
If you want, compare this to another domain of scandals - did the use of ‘gate’ for scandals follow a similar pattern?
page <- read_html("https://en.wikipedia.org/wiki/List_of_%22-gate%22_scandals")
tables <- html_table(page)
politics <- extract2(tables,3)
# base plot
hist(as.numeric(politics$Year))
# ggplot
library(ggplot2)
ggplot(politics,aes(x=Year))+
geom_histogram(stat="count")+
theme(axis.text.x = element_text(angle = 90))
## Warning: Ignoring unknown parameters: binwidth, bins, pad
Now we got tables - but how do we get the rest of the webpage? To make it more interesting, select a speech from your results (we will learn how to do this automatically but for now, you can do this by visiting the URL in your browser again) on which we will practice scraping the text of a page.
The function read_html()
parses the html code, similar to what our browser does. Still, it gives us the entire document including the HTML commands. Since we do not want the formatting of the webpage, we can use the function html_text() to extract the Webpage text.
Try it out: Parse the URL of the speech you are interested in and apply html_text()
to it.
speech <- read_html("https://www.presidency.ucsb.edu/documents/statement-administration-policy-hj-res-46-terminating-the-national-emergency-declared-the")
html_text(speech)
## [1] "(window.NREUM||(NREUM={})).init={ajax:{deny_list:[\"bam-cell.nr-data.net\"]}};(window.NREUM||(NREUM={})).loader_config={licenseKey:\"dee899de70\",applicationID:\"80106271\"};window.NREUM||(NREUM={}),__nr_require=function(t,e,n){function r(n){if(!e[n]){var i=e[n]={exports:{}};t[n][0].call(i.exports,function(e){var i=t[n][1][e];return r(i||e)},i,i.exports)}return e[n].exports}if(\"function\"==typeof __nr_require)return __nr_require;for(var i=0;i<n.length;i++)r(n[i]);return r}({1:[function(t,e,n){function r(){}function i(t,e,n,r){return function(){return s.recordSupportability(\"API/\"+e+\"/called\"),o(t+e,[u.now()].concat(c(arguments)),n?null:this,r),n?void 0:this}}var o=t(\"handle\"),a=t(9),c=t(10),f=t(\"ee\").get(\"tracer\"),u=t(\"loader\"),s=t(4),d=NREUM;\"undefined\"==typeof window.newrelic&&(newrelic=d);var p=[\"setPageViewName\",\"setCustomAttribute\",\"setErrorHandler\",\"finished\",\"addToTrace\",\"inlineHit\",\"addRelease\"],l=\"api-\",v=l+\"ixn-\";a(p,function(t,e){d[e]=i(l,e,!0,\"api\")}),d.addPageAction=i(l,\"addPageAction\",!0),d.setCurrentRouteName=i(l,\"routeName\",!0),e.exports=newrelic,d.interaction=function(){return(new r).get()};var m=r.prototype={createTracer:function(t,e){var n={},r=this,i=\"function\"==typeof e;return o(v+\"tracer\",[u.now(),t,n],r),function(){if(f.emit((i?\"\":\"no-\")+\"fn-start\",[u.now(),r,i],n),i)try{return e.apply(this,arguments)}catch(t){throw f.emit(\"fn-err\",[arguments,this,t],n),t}finally{f.emit(\"fn-end\",[u.now()],n)}}}};a(\"actionText,setName,setAttribute,save,ignore,onEnd,getContext,end,get\".split(\",\"),function(t,e){m[e]=i(v,e)}),newrelic.noticeError=function(t,e){\"string\"==typeof t&&(t=new Error(t)),s.recordSupportability(\"API/noticeError/called\"),o(\"err\",[t,u.now(),!1,e])}},{}],2:[function(t,e,n){function r(t){if(NREUM.init){for(var e=NREUM.init,n=t.split(\".\"),r=0;r<n.length-1;r++)if(e=e[n[r]],\"object\"!=typeof e)return;return e=e[n[n.length-1]]}}e.exports={getConfiguration:r}},{}],3:[function(t,e,n){var r=!1;try{var i=Object.defineProperty({},\"passive\",{get:function(){r=!0}});window.addEventListener(\"testPassive\",null,i),window.removeEventListener(\"testPassive\",null,i)}catch(o){}e.exports=function(t){return r?{passive:!0,capture:!!t}:!!t}},{}],4:[function(t,e,n){function r(t,e){var n=[a,t,{name:t},e];return o(\"storeMetric\",n,null,\"api\"),n}function i(t,e){var n=[c,t,{name:t},e];return o(\"storeEventMetrics\",n,null,\"api\"),n}var o=t(\"handle\"),a=\"sm\",c=\"cm\";e.exports={constants:{SUPPORTABILITY_METRIC:a,CUSTOM_METRIC:c},recordSupportability:r,recordCustom:i}},{}],5:[function(t,e,n){function r(){return c.exists&&performance.now?Math.round(performance.now()):(o=Math.max((new Date).getTime(),o))-a}function i(){return o}var o=(new Date).getTime(),a=o,c=t(11);e.exports=r,e.exports.offset=a,e.exports.getLastTimestamp=i},{}],6:[function(t,e,n){function r(t,e){var n=t.getEntries();n.forEach(function(t){\"first-paint\"===t.name?l(\"timing\",[\"fp\",Math.floor(t.startTime)]):\"first-contentful-paint\"===t.name&&l(\"timing\",[\"fcp\",Math.floor(t.startTime)])})}function i(t,e){var n=t.getEntries();if(n.length>0){var r=n[n.length-1];if(u&&u<r.startTime)return;var i=[r],o=a({});o&&i.push(o),l(\"lcp\",i)}}function o(t){t.getEntries().forEach(function(t){t.hadRecentInput||l(\"cls\",[t])})}function a(t){var e=navigator.connection||navigator.mozConnection||navigator.webkitConnection;if(e)return e.type&&(t[\"net-type\"]=e.type),e.effectiveType&&(t[\"net-etype\"]=e.effectiveType),e.rtt&&(t[\"net-rtt\"]=e.rtt),e.downlink&&(t[\"net-dlink\"]=e.downlink),t}function c(t){if(t instanceof y&&!w){var e=Math.round(t.timeStamp),n={type:t.type};a(n),e<=v.now()?n.fid=v.now()-e:e>v.offset&&e<=Date.now()?(e-=v.offset,n.fid=v.now()-e):e=v.now(),w=!0,l(\"timing\",[\"fi\",e,n])}}function f(t){\"hidden\"===t&&(u=v.now(),l(\"pageHide\",[u]))}if(!(\"init\"in NREUM&&\"page_view_timing\"in NREUM.init&&\"enabled\"in NREUM.init.page_view_timing&&NREUM.init.page_view_timing.enabled===!1)){var u,s,d,p,l=t(\"handle\"),v=t(\"loader\"),m=t(8),g=t(3),y=NREUM.o.EV;if(\"PerformanceObserver\"in window&&\"function\"==typeof window.PerformanceObserver){s=new PerformanceObserver(r);try{s.observe({entryTypes:[\"paint\"]})}catch(h){}d=new PerformanceObserver(i);try{d.observe({entryTypes:[\"largest-contentful-paint\"]})}catch(h){}p=new PerformanceObserver(o);try{p.observe({type:\"layout-shift\",buffered:!0})}catch(h){}}if(\"addEventListener\"in document){var w=!1,b=[\"click\",\"keydown\",\"mousedown\",\"pointerdown\",\"touchstart\"];b.forEach(function(t){document.addEventListener(t,c,g(!1))})}m(f)}},{}],7:[function(t,e,n){function r(t,e){if(!i)return!1;if(t!==i)return!1;if(!e)return!0;if(!o)return!1;for(var n=o.split(\".\"),r=e.split(\".\"),a=0;a<r.length;a++)if(r[a]!==n[a])return!1;return!0}var i=null,o=null,a=/Version\\/(\\S+)\\s+Safari/;if(navigator.userAgent){var c=navigator.userAgent,f=c.match(a);f&&c.indexOf(\"Chrome\")===-1&&c.indexOf(\"Chromium\")===-1&&(i=\"Safari\",o=f[1])}e.exports={agent:i,version:o,match:r}},{}],8:[function(t,e,n){function r(t){function e(){t(c&&document[c]?document[c]:document[o]?\"hidden\":\"visible\")}\"addEventListener\"in document&&a&&document.addEventListener(a,e,i(!1))}var i=t(3);e.exports=r;var o,a,c;\"undefined\"!=typeof document.hidden?(o=\"hidden\",a=\"visibilitychange\",c=\"visibilityState\"):\"undefined\"!=typeof document.msHidden?(o=\"msHidden\",a=\"msvisibilitychange\"):\"undefined\"!=typeof document.webkitHidden&&(o=\"webkitHidden\",a=\"webkitvisibilitychange\",c=\"webkitVisibilityState\")},{}],9:[function(t,e,n){function r(t,e){var n=[],r=\"\",o=0;for(r in t)i.call(t,r)&&(n[o]=e(r,t[r]),o+=1);return n}var i=Object.prototype.hasOwnProperty;e.exports=r},{}],10:[function(t,e,n){function r(t,e,n){e||(e=0),\"undefined\"==typeof n&&(n=t?t.length:0);for(var r=-1,i=n-e||0,o=Array(i<0?0:i);++r<i;)o[r]=t[e+r];return o}e.exports=r},{}],11:[function(t,e,n){e.exports={exists:\"undefined\"!=typeof window.performance&&window.performance.timing&&\"undefined\"!=typeof window.performance.timing.navigationStart}},{}],ee:[function(t,e,n){function r(){}function i(t){function e(t){return t&&t instanceof r?t:t?u(t,f,a):a()}function n(n,r,i,o,a){if(a!==!1&&(a=!0),!l.aborted||o){t&&a&&t(n,r,i);for(var c=e(i),f=m(n),u=f.length,s=0;s<u;s++)f[s].apply(c,r);var p=d[w[n]];return p&&p.push([b,n,r,c]),c}}function o(t,e){h[t]=m(t).concat(e)}function v(t,e){var n=h[t];if(n)for(var r=0;r<n.length;r++)n[r]===e&&n.splice(r,1)}function m(t){return h[t]||[]}function g(t){return p[t]=p[t]||i(n)}function y(t,e){l.aborted||s(t,function(t,n){e=e||\"feature\",w[n]=e,e in d||(d[e]=[])})}var h={},w={},b={on:o,addEventListener:o,removeEventListener:v,emit:n,get:g,listeners:m,context:e,buffer:y,abort:c,aborted:!1};return b}function o(t){return u(t,f,a)}function a(){return new r}function c(){(d.api||d.feature)&&(l.aborted=!0,d=l.backlog={})}var f=\"nr@context\",u=t(\"gos\"),s=t(9),d={},p={},l=e.exports=i();e.exports.getOrSetContext=o,l.backlog=d},{}],gos:[function(t,e,n){function r(t,e,n){if(i.call(t,e))return t[e];var r=n();if(Object.defineProperty&&Object.keys)try{return Object.defineProperty(t,e,{value:r,writable:!0,enumerable:!1}),r}catch(o){}return t[e]=r,r}var i=Object.prototype.hasOwnProperty;e.exports=r},{}],handle:[function(t,e,n){function r(t,e,n,r){i.buffer([t],r),i.emit(t,e,n)}var i=t(\"ee\").get(\"handle\");e.exports=r,r.ee=i},{}],id:[function(t,e,n){function r(t){var e=typeof t;return!t||\"object\"!==e&&\"function\"!==e?-1:t===window?0:a(t,o,function(){return i++})}var i=1,o=\"nr@id\",a=t(\"gos\");e.exports=r},{}],loader:[function(t,e,n){function r(){if(!M++){var t=T.info=NREUM.info,e=m.getElementsByTagName(\"script\")[0];if(setTimeout(u.abort,3e4),!(t&&t.licenseKey&&t.applicationID&&e))return u.abort();f(x,function(e,n){t[e]||(t[e]=n)});var n=a();c(\"mark\",[\"onload\",n+T.offset],null,\"api\"),c(\"timing\",[\"load\",n]);var r=m.createElement(\"script\");0===t.agent.indexOf(\"http://\")||0===t.agent.indexOf(\"https://\")?r.src=t.agent:r.src=l+\"://\"+t.agent,e.parentNode.insertBefore(r,e)}}function i(){\"complete\"===m.readyState&&o()}function o(){c(\"mark\",[\"domContent\",a()+T.offset],null,\"api\")}var a=t(5),c=t(\"handle\"),f=t(9),u=t(\"ee\"),s=t(7),d=t(2),p=t(3),l=d.getConfiguration(\"ssl\")===!1?\"http\":\"https\",v=window,m=v.document,g=\"addEventListener\",y=\"attachEvent\",h=v.XMLHttpRequest,w=h&&h.prototype,b=!1;NREUM.o={ST:setTimeout,SI:v.setImmediate,CT:clearTimeout,XHR:h,REQ:v.Request,EV:v.Event,PR:v.Promise,MO:v.MutationObserver};var E=\"\"+location,x={beacon:\"bam.nr-data.net\",errorBeacon:\"bam.nr-data.net\",agent:\"js-agent.newrelic.com/nr-1216.min.js\"},O=h&&w&&w[g]&&!/CriOS/.test(navigator.userAgent),T=e.exports={offset:a.getLastTimestamp(),now:a,origin:E,features:{},xhrWrappable:O,userAgent:s,disabled:b};if(!b){t(1),t(6),m[g]?(m[g](\"DOMContentLoaded\",o,p(!1)),v[g](\"load\",r,p(!1))):(m[y](\"onreadystatechange\",i),v[y](\"onload\",r)),c(\"mark\",[\"firstbyte\",a.getLastTimestamp()],null,\"api\");var M=0}},{}],\"wrap-function\":[function(t,e,n){function r(t,e){function n(e,n,r,f,u){function nrWrapper(){var o,a,s,p;try{a=this,o=d(arguments),s=\"function\"==typeof r?r(o,a):r||{}}catch(l){i([l,\"\",[o,a,f],s],t)}c(n+\"start\",[o,a,f],s,u);try{return p=e.apply(a,o)}catch(v){throw c(n+\"err\",[o,a,v],s,u),v}finally{c(n+\"end\",[o,a,p],s,u)}}return a(e)?e:(n||(n=\"\"),nrWrapper[p]=e,o(e,nrWrapper,t),nrWrapper)}function r(t,e,r,i,o){r||(r=\"\");var c,f,u,s=\"-\"===r.charAt(0);for(u=0;u<e.length;u++)f=e[u],c=t[f],a(c)||(t[f]=n(c,s?f+r:r,i,f,o))}function c(n,r,o,a){if(!v||e){var c=v;v=!0;try{t.emit(n,r,o,e,a)}catch(f){i([f,n,r,o],t)}v=c}}return t||(t=s),n.inPlace=r,n.flag=p,n}function i(t,e){e||(e=s);try{e.emit(\"internal-error\",t)}catch(n){}}function o(t,e,n){if(Object.defineProperty&&Object.keys)try{var r=Object.keys(t);return r.forEach(function(n){Object.defineProperty(e,n,{get:function(){return t[n]},set:function(e){return t[n]=e,e}})}),e}catch(o){i([o],n)}for(var a in t)l.call(t,a)&&(e[a]=t[a]);return e}function a(t){return!(t&&t instanceof Function&&t.apply&&!t[p])}function c(t,e){var n=e(t);return n[p]=t,o(t,n,s),n}function f(t,e,n){var r=t[e];t[e]=c(r,n)}function u(){for(var t=arguments.length,e=new Array(t),n=0;n<t;++n)e[n]=arguments[n];return e}var s=t(\"ee\"),d=t(10),p=\"nr@original\",l=Object.prototype.hasOwnProperty,v=!1;e.exports=r,e.exports.wrapFunction=c,e.exports.wrapInPlace=f,e.exports.argsToArray=u},{}]},{},[\"loader\"]);Statement of Administration Policy: H.J. Res. 46 - Terminating the National Emergency Declared by the President on the Southern Border | The American Presidency Projectwindow.jQuery || document.write(\"<script src='/sites/default/modules/contrib/jquery_update/replace/jquery/1.11/jquery.min.js'>\\x3C/script>\")window.jQuery.ui || document.write(\"<script src='/sites/default/modules/contrib/jquery_update/replace/ui/ui/minified/jquery-ui.min.js'>\\x3C/script>\")(function(i,s,o,g,r,a,m){i[\"GoogleAnalyticsObject\"]=r;i[r]=i[r]||function(){(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)})(window,document,\"script\",\"https://www.google-analytics.com/analytics.js\",\"ga\");ga(\"create\", \"UA-86410002-1\", {\"cookieDomain\":\"auto\",\"allowLinker\":true});ga(\"require\", \"linker\");ga(\"linker:autoLink\", [\"dev-wwwpresidencyucsbedu.pantheonsite.io\",\"www.presidency.ucsb.edu\"]);ga(\"set\", \"anonymizeIp\", true);ga(\"send\", \"pageview\");jQuery.extend(Drupal.settings, {\"basePath\":\"\\/\",\"pathPrefix\":\"\",\"setHasJsCookie\":0,\"ajaxPageState\":{\"theme\":\"app\",\"theme_token\":\"GvyOnyVaJM7HUSblJ51c6dck1-9Opx0JuM2RwYAMUPk\",\"js\":{\"sites\\/default\\/libraries\\/jquery-ui-multiselect-widget\\/src\\/jquery.multiselect.js\":1,\"sites\\/default\\/libraries\\/jquery-ui-multiselect-widget\\/src\\/jquery.multiselect.filter.js\":1,\"sites\\/default\\/modules\\/contrib\\/jquery_ui_multiselect_widget\\/jquery_ui_multiselect_widget.js\":1,\"modules\\/statistics\\/statistics.js\":1,\"sites\\/default\\/themes\\/bootstrap\\/js\\/bootstrap.js\":1,\"\\/\\/ajax.aspnetcdn.com\\/ajax\\/jQuery\\/jquery-1.11.2.min.js\":1,\"0\":1,\"misc\\/jquery-extend-3.4.0.js\":1,\"misc\\/jquery-html-prefilter-3.5.0-backport.js\":1,\"misc\\/jquery.once.js\":1,\"misc\\/drupal.js\":1,\"\\/\\/ajax.aspnetcdn.com\\/ajax\\/jquery.ui\\/1.11.4\\/jquery-ui.min.js\":1,\"1\":1,\"sites\\/default\\/modules\\/contrib\\/extlink\\/extlink.js\":1,\"sites\\/default\\/modules\\/contrib\\/better_exposed_filters\\/better_exposed_filters.js\":1,\"sites\\/default\\/modules\\/contrib\\/google_analytics\\/googleanalytics.js\":1,\"2\":1,\"sites\\/default\\/modules\\/contrib\\/field_group\\/field_group.js\":1,\"sites\\/default\\/modules\\/contrib\\/rrssb\\/rrssb.init.js\":1,\"sites\\/default\\/libraries\\/rrssb-plus\\/js\\/rrssb.min.js\":1,\"sites\\/default\\/themes\\/app\\/bootstrap\\/js\\/affix.js\":1,\"sites\\/default\\/themes\\/app\\/bootstrap\\/js\\/alert.js\":1,\"sites\\/default\\/themes\\/app\\/bootstrap\\/js\\/button.js\":1,\"sites\\/default\\/themes\\/app\\/bootstrap\\/js\\/carousel.js\":1,\"sites\\/default\\/themes\\/app\\/bootstrap\\/js\\/collapse.js\":1,\"sites\\/default\\/themes\\/app\\/bootstrap\\/js\\/dropdown.js\":1,\"sites\\/default\\/themes\\/app\\/bootstrap\\/js\\/modal.js\":1,\"sites\\/default\\/themes\\/app\\/bootstrap\\/js\\/tooltip.js\":1,\"sites\\/default\\/themes\\/app\\/bootstrap\\/js\\/popover.js\":1,\"sites\\/default\\/themes\\/app\\/bootstrap\\/js\\/scrollspy.js\":1,\"sites\\/default\\/themes\\/app\\/bootstrap\\/js\\/tab.js\":1,\"sites\\/default\\/themes\\/app\\/bootstrap\\/js\\/transition.js\":1,\"sites\\/default\\/themes\\/app\\/scripts\\/scripts.js\":1},\"css\":{\"modules\\/system\\/system.base.css\":1,\"misc\\/ui\\/jquery.ui.core.css\":1,\"misc\\/ui\\/jquery.ui.theme.css\":1,\"misc\\/ui\\/jquery.ui.accordion.css\":1,\"sites\\/default\\/modules\\/contrib\\/date\\/date_api\\/date.css\":1,\"sites\\/default\\/modules\\/contrib\\/date\\/date_popup\\/themes\\/datepicker.1.7.css\":1,\"sites\\/default\\/modules\\/contrib\\/date\\/date_repeat_field\\/date_repeat_field.css\":1,\"modules\\/field\\/theme\\/field.css\":1,\"modules\\/node\\/node.css\":1,\"sites\\/default\\/modules\\/contrib\\/extlink\\/extlink.css\":1,\"sites\\/default\\/modules\\/contrib\\/views\\/css\\/views.css\":1,\"sites\\/default\\/modules\\/contrib\\/ctools\\/css\\/ctools.css\":1,\"sites\\/default\\/libraries\\/jquery-ui-multiselect-widget\\/jquery.multiselect.css\":1,\"sites\\/default\\/libraries\\/jquery-ui-multiselect-widget\\/jquery.multiselect.filter.css\":1,\"sites\\/default\\/modules\\/contrib\\/jquery_ui_multiselect_widget\\/jquery_ui_multiselect_widget.css\":1,\"sites\\/default\\/modules\\/contrib\\/vefl\\/css\\/vefl-layouts.css\":1,\"public:\\/\\/rrssb\\/rrssb.4e2262bd.css\":1,\"sites\\/default\\/libraries\\/rrssb-plus\\/css\\/rrssb.css\":1,\"sites\\/default\\/themes\\/app\\/css\\/style.css\":1,\"sites\\/default\\/themes\\/app\\/css\\/oog.css\":1,\"sites\\/default\\/themes\\/app\\/css\\/print.css\":1}},\"jquery_ui_multiselect_widget\":{\"module_path\":\"sites\\/default\\/modules\\/contrib\\/jquery_ui_multiselect_widget\",\"multiple\":1,\"filter\":1,\"subselector\":\"#edit-category2\",\"selectedlist\":\"4\",\"autoOpen\":0,\"header\":1,\"height\":\"auto\",\"classes\":\"app-uberselect\",\"filter_auto_reset\":1,\"filter_width\":\"auto\",\"jquery_ui_multiselect_widget_path_match_exclude\":\"admin\\/*\\r\\nmedia\\/*\\r\\nfile\\/*\\r\\nsystem\\/ajax\"},\"better_exposed_filters\":{\"datepicker\":false,\"slider\":false,\"settings\":[],\"autosubmit\":false,\"views\":{\"dpg_docs_media\":{\"displays\":{\"block_2\":{\"filters\":[]}}},\"report_a_typo\":{\"displays\":{\"block\":{\"filters\":[]}}},\"document_attached_files\":{\"displays\":{\"block\":{\"filters\":[]},\"block_1\":{\"filters\":[]}}}}},\"urlIsAjaxTrusted\":{\"\\/advanced-search\":true},\"extlink\":{\"extTarget\":\"_blank\",\"extClass\":0,\"extLabel\":\"(link is external)\",\"extImgClass\":0,\"extIconPlacement\":\"append\",\"extSubdomains\":1,\"extExclude\":\"\",\"extInclude\":\"\",\"extCssExclude\":\"\",\"extCssExplicit\":\"\",\"extAlert\":0,\"extAlertText\":\"This link will take you to an external web site.\",\"mailtoClass\":0,\"mailtoLabel\":\"(link sends e-mail)\"},\"googleanalytics\":{\"trackOutbound\":1,\"trackMailto\":1,\"trackDownload\":1,\"trackDownloadExtensions\":\"7z|aac|arc|arj|asf|asx|avi|bin|csv|doc(x|m)?|dot(x|m)?|exe|flv|gif|gz|gzip|hqx|jar|jpe?g|js|mp(2|3|4|e?g)|mov(ie)?|msi|msp|pdf|phps|png|ppt(x|m)?|pot(x|m)?|pps(x|m)?|ppam|sld(x|m)?|thmx|qtm?|ra(m|r)?|sea|sit|tar|tgz|torrent|txt|wav|wma|wmv|wpd|xls(x|m|b)?|xlt(x|m)|xlam|xml|z|zip\",\"trackDomainMode\":2,\"trackCrossDomains\":[\"dev-wwwpresidencyucsbedu.pantheonsite.io\",\"www.presidency.ucsb.edu\"]},\"statistics\":{\"data\":{\"nid\":\"335315\"},\"url\":\"\\/modules\\/statistics\\/statistics.php\"},\"field_group\":{\"div\":\"full\"},\"rrssb\":{\"size\":\"1\",\"shrink\":\"1\",\"regrow\":\"\",\"minRows\":\"1\",\"maxRows\":\"1\",\"prefixReserve\":\"1em\",\"prefixHide\":\"1em\",\"alignRight\":0},\"bootstrap\":{\"anchorsFix\":1,\"anchorsSmoothScrolling\":1,\"formHasError\":1,\"popoverEnabled\":0,\"popoverOptions\":{\"animation\":1,\"html\":0,\"placement\":\"right\",\"selector\":\"\",\"trigger\":\"click\",\"triggerAutoclose\":1,\"title\":\"\",\"content\":\"\",\"delay\":0,\"container\":\"body\"},\"tooltipEnabled\":1,\"tooltipOptions\":{\"animation\":1,\"html\":0,\"placement\":\"auto left\",\"selector\":\"\",\"trigger\":\"hover focus\",\"delay\":0,\"container\":\"body\"}}});\n \n Skip to main content\n \n \n\n \n \n \n The American Presidency Project\n\nAbout Search\n\n\n\n \n \n \n \n \n \n\n \n \n Toggle navigation\n \n \n \n \n \n\n \n Documents Guidebook\nCategory Attributes\n\nStatistics\nMedia Archive\nPresidents\nAnalyses\nGIVE\n\n \n \n\n \n \n\n \n \n\n \n Documents\n \n \n Archive Guidebook\nCategories\nAttributes\n\n\nCategories\n \n \n Presidential (227224) Correspondents' Association (32)\nEulogies (62)\nExecutive Orders (6303)\nFireside Chats (27)\nInterviews (958)\nLetters (4626)\nMiscellaneous Remarks (15435)\nMiscellaneous Written (842)\nNews Conferences (2481)\nSigning Statements (2145)\nSpoken Addresses and Remarks (18603)\nFarewell Address (11)\nInaugural Addresses (62)\nMemoranda (3123)\nMessages (11339)\nOral Address (631)\nProclamations (8720)\nSaturday Weekly Addresses (Radio and Webcast) (1639)\nState Dinners (953)\nState of the Union Addresses (98)\nState of the Union Messages (140)\nStatements (13673)\nVetoes (1201)\nWritten Messages (23777)\nWritten Presidential Orders (33338)\n\nPress/Media (17648) Press Briefings (6698)\n\nElections and Transitions (24542) Campaign Documents (4518)\nConvention Speeches (81)\nDebates (171)\nParty Platforms (103)\nTransition Documents (552)\n\nMiscellaneous (430) Opposition Party Responses (33)\nPost Presidential Remarks (10)\n\nCongressional (38)\n\n\n\n \n \n \n \n \n \n \n \n \n \n\n \n \n \n \n\n \n Donald J. Trump \n\n \n \n \n 45th President of the United States: 2017 - 2021\n \n \n\n \n Statement of Administration Policy: H.J. Res. 46 - Terminating the National Emergency Declared by the President on the Southern Border\n \n\n\n \n\n \n February 26, 2019 \n\n \n STATEMENT OF ADMINISTRATION POLICY\n(House)(Rep. Castro, D-TX, and 233 cosponsors)\nThe Administration strongly opposes H.J. Res. 46. The current situation at the Southern Border presents a humanitarian and security crisis that threatens core national security interests and constitutes a national emergency. The Southern Border is a major entry point for criminals, gang members, and illicit narcotics. The problem of large-scale unlawful migration through the Southern Border is enduring, and, despite the Administration's use of existing statutory authorities, in recent years the situation has worsened in certain respects. In particular, we have recently seen sharp increases in the number of illegal entrances into the United States of family units, unaccompanied minors, and persons claiming a fear of return—aliens whom the Administration is largely unable to detain or remove because of antiquated laws and problematic court decisions.\nThe resolution would terminate the national emergency declared by the President on February 15, 2019, and undermine the Administration's ability to respond effectively to the ongoing crisis at the Southern Border. The President's emergency declaration, and his further determination that the emergency requires the use of the Armed Forces, allowed the President to invoke the construction authority provided in 10 U.S.C. 2808, and made that authority available to the Secretary of Defense, within his discretion, to undertake military construction projects that are necessary to support such use of the Armed Forces. This is the same authority that President George W. Bush and President Barack Obama used to undertake more than 18 different military construction projects between 2001 and 2013.\nIf H.J. Res. 46 were presented to the President in its current form, his advisors would recommend that he veto it.\n \n\n \n Donald J. Trump, Statement of Administration Policy: H.J. Res. 46 - Terminating the National Emergency Declared by the President on the Southern Border Online by Gerhard Peters and John T. Woolley, The American Presidency Project https://www.presidency.ucsb.edu/node/335315 \n \n \n \n \n Filed Under \nCategoriesOMB: Office of Management and BudgetStatements of Administration Policy\n \n \n \n \n \n \n \n \n \n \n \n \ntwitterfacebooklinkedingoogle+email\n \n Simple Search of Our Archives\n \n \n \n \n \n\n \n \n \n \n \n \n \n \n \n \n\n \n # per page\n5102550100 \n \n \n\n \n Apply\n \n \n \n \n \n\n\n\n \n \n \n \n \n \n \n Report a Typo \n \n \n \n \n \n \n \n \n \n \n\n\n\n\n\n\n\n \n \n \n \n\n\n \n The American Presidency ProjectJohn Woolley and Gerhard PetersContact\n\nTwitter Facebook\n\nCopyright © The American Presidency ProjectTerms of Service | Privacy | Accessibility\n\n \n window.NREUM||(NREUM={});NREUM.info={\"beacon\":\"bam-cell.nr-data.net\",\"licenseKey\":\"dee899de70\",\"applicationID\":\"80106271\",\"transactionName\":\"bl1XYxNYWkVYVxFdWVcXdFQVUFtYFlAWa1NBTEdWEmZaWV1ROkRXXl1qQQhcQw==\",\"queueTime\":0,\"applicationTime\":611,\"atts\":\"QhpUFVtCSUs=\",\"errorBeacon\":\"bam-cell.nr-data.net\",\"agent\":\"\"}"
Did you find the speech you saw in your browser? Admittedly, this still looks very messy. Maybe you are thinking: If only, there would be a way to tell R to just get the text of the speech! Luckily there is.
The html_elements()
command allows us to select specific ‘elements’ of the HTML Code. One example would be the HTML tags we learned about and their respective content. You can have a look at the documentation of the html_elements()
command for more information.
We will get into CSS selectors in a bit. For now, we will focus on two of the most important selectors:
<h1>
tag
html_text()
command to extract just the text rather than the entire element with its formattinghtml_elements(speech,"h1")
## {xml_nodeset (1)}
## [1] <h1>Statement of Administration Policy: H.J. Res. 46 - Terminating the Na ...
html_elements(speech,"h2")
## {xml_nodeset (3)}
## [1] <h2 class="block-title">Documents</h2>
## [2] <h2 class="block-title">Categories</h2>
## [3] <h2 class="block-title">Simple Search of Our Archives</h2>
html_elements(speech,"h3")
## {xml_nodeset (4)}
## [1] <h3 class="diet-title"><a href="/people/president/donald-j-trump">Donald ...
## [2] <h3 class="oog-label">Filed Under</h3>
## [3] <h3 class="label-above oog-label ds ">Categories</h3>\n
## [4] <h3>Report a Typo</h3>
html_elements(speech,"h4")
## {xml_nodeset (0)}
html_elements(speech,"*")
## {xml_nodeset (310)}
## [1] <head profile="http://www.w3.org/1999/xhtml/vocab">\n<meta charset="utf- ...
## [2] <meta charset="utf-8">\n
## [3] <script type="text/javascript">(window.NREUM||(NREUM={})).init={ajax:{de ...
## [4] <meta name="viewport" content="width=device-width, initial-scale=1.0">\n
## [5] <meta http-equiv="Content-Type" content="text/html; charset=utf-8">\n
## [6] <meta name="Generator" content="Drupal 7 (http://drupal.org)">\n
## [7] <link rel="canonical" href="/documents/statement-administration-policy-h ...
## [8] <link rel="shortlink" href="/node/335315">\n
## [9] <link rel="shortcut icon" href="https://www.presidency.ucsb.edu/sites/de ...
## [10] <title>Statement of Administration Policy: H.J. Res. 46 - Terminating th ...
## [11] <link href="//fonts.googleapis.com/css?family=Open+Sans:400,400italic,80 ...
## [12] <link href="//netdna.bootstrapcdn.com/bootstrap/3.0.0/css/bootstrap-glyp ...
## [13] <link type="text/css" rel="stylesheet" href="https://www.presidency.ucsb ...
## [14] <link type="text/css" rel="stylesheet" href="https://www.presidency.ucsb ...
## [15] <link type="text/css" rel="stylesheet" href="https://www.presidency.ucsb ...
## [16] <link type="text/css" rel="stylesheet" href="https://www.presidency.ucsb ...
## [17] <link type="text/css" rel="stylesheet" href="https://www.presidency.ucsb ...
## [18] <link type="text/css" rel="stylesheet" href="https://www.presidency.ucsb ...
## [19] <script src="//ajax.aspnetcdn.com/ajax/jQuery/jquery-1.11.2.min.js"></sc ...
## [20] <script>window.jQuery || document.write("<script src='/sites/default/mod ...
## ...
# or with extracting text
html_elements(speech,"h1") %>% html_text()
## [1] "Statement of Administration Policy: H.J. Res. 46 - Terminating the National Emergency Declared by the President on the Southern Border"
html_elements(speech,"h2") %>% html_text()
## [1] "Documents" "Categories"
## [3] "Simple Search of Our Archives"
html_elements(speech,"h3") %>% html_text()
## [1] "Donald J. Trump" "Filed Under" "Categories" "Report a Typo"
html_elements(speech,"h4") %>% html_text()
## character(0)
html_elements(speech,"*") %>% html_text()
## [1] "(window.NREUM||(NREUM={})).init={ajax:{deny_list:[\"bam-cell.nr-data.net\"]}};(window.NREUM||(NREUM={})).loader_config={licenseKey:\"dee899de70\",applicationID:\"80106271\"};window.NREUM||(NREUM={}),__nr_require=function(t,e,n){function r(n){if(!e[n]){var i=e[n]={exports:{}};t[n][0].call(i.exports,function(e){var i=t[n][1][e];return r(i||e)},i,i.exports)}return e[n].exports}if(\"function\"==typeof __nr_require)return __nr_require;for(var i=0;i<n.length;i++)r(n[i]);return r}({1:[function(t,e,n){function r(){}function i(t,e,n,r){return function(){return s.recordSupportability(\"API/\"+e+\"/called\"),o(t+e,[u.now()].concat(c(arguments)),n?null:this,r),n?void 0:this}}var o=t(\"handle\"),a=t(9),c=t(10),f=t(\"ee\").get(\"tracer\"),u=t(\"loader\"),s=t(4),d=NREUM;\"undefined\"==typeof window.newrelic&&(newrelic=d);var p=[\"setPageViewName\",\"setCustomAttribute\",\"setErrorHandler\",\"finished\",\"addToTrace\",\"inlineHit\",\"addRelease\"],l=\"api-\",v=l+\"ixn-\";a(p,function(t,e){d[e]=i(l,e,!0,\"api\")}),d.addPageAction=i(l,\"addPageAction\",!0),d.setCurrentRouteName=i(l,\"routeName\",!0),e.exports=newrelic,d.interaction=function(){return(new r).get()};var m=r.prototype={createTracer:function(t,e){var n={},r=this,i=\"function\"==typeof e;return o(v+\"tracer\",[u.now(),t,n],r),function(){if(f.emit((i?\"\":\"no-\")+\"fn-start\",[u.now(),r,i],n),i)try{return e.apply(this,arguments)}catch(t){throw f.emit(\"fn-err\",[arguments,this,t],n),t}finally{f.emit(\"fn-end\",[u.now()],n)}}}};a(\"actionText,setName,setAttribute,save,ignore,onEnd,getContext,end,get\".split(\",\"),function(t,e){m[e]=i(v,e)}),newrelic.noticeError=function(t,e){\"string\"==typeof t&&(t=new Error(t)),s.recordSupportability(\"API/noticeError/called\"),o(\"err\",[t,u.now(),!1,e])}},{}],2:[function(t,e,n){function r(t){if(NREUM.init){for(var e=NREUM.init,n=t.split(\".\"),r=0;r<n.length-1;r++)if(e=e[n[r]],\"object\"!=typeof e)return;return e=e[n[n.length-1]]}}e.exports={getConfiguration:r}},{}],3:[function(t,e,n){var r=!1;try{var i=Object.defineProperty({},\"passive\",{get:function(){r=!0}});window.addEventListener(\"testPassive\",null,i),window.removeEventListener(\"testPassive\",null,i)}catch(o){}e.exports=function(t){return r?{passive:!0,capture:!!t}:!!t}},{}],4:[function(t,e,n){function r(t,e){var n=[a,t,{name:t},e];return o(\"storeMetric\",n,null,\"api\"),n}function i(t,e){var n=[c,t,{name:t},e];return o(\"storeEventMetrics\",n,null,\"api\"),n}var o=t(\"handle\"),a=\"sm\",c=\"cm\";e.exports={constants:{SUPPORTABILITY_METRIC:a,CUSTOM_METRIC:c},recordSupportability:r,recordCustom:i}},{}],5:[function(t,e,n){function r(){return c.exists&&performance.now?Math.round(performance.now()):(o=Math.max((new Date).getTime(),o))-a}function i(){return o}var o=(new Date).getTime(),a=o,c=t(11);e.exports=r,e.exports.offset=a,e.exports.getLastTimestamp=i},{}],6:[function(t,e,n){function r(t,e){var n=t.getEntries();n.forEach(function(t){\"first-paint\"===t.name?l(\"timing\",[\"fp\",Math.floor(t.startTime)]):\"first-contentful-paint\"===t.name&&l(\"timing\",[\"fcp\",Math.floor(t.startTime)])})}function i(t,e){var n=t.getEntries();if(n.length>0){var r=n[n.length-1];if(u&&u<r.startTime)return;var i=[r],o=a({});o&&i.push(o),l(\"lcp\",i)}}function o(t){t.getEntries().forEach(function(t){t.hadRecentInput||l(\"cls\",[t])})}function a(t){var e=navigator.connection||navigator.mozConnection||navigator.webkitConnection;if(e)return e.type&&(t[\"net-type\"]=e.type),e.effectiveType&&(t[\"net-etype\"]=e.effectiveType),e.rtt&&(t[\"net-rtt\"]=e.rtt),e.downlink&&(t[\"net-dlink\"]=e.downlink),t}function c(t){if(t instanceof y&&!w){var e=Math.round(t.timeStamp),n={type:t.type};a(n),e<=v.now()?n.fid=v.now()-e:e>v.offset&&e<=Date.now()?(e-=v.offset,n.fid=v.now()-e):e=v.now(),w=!0,l(\"timing\",[\"fi\",e,n])}}function f(t){\"hidden\"===t&&(u=v.now(),l(\"pageHide\",[u]))}if(!(\"init\"in NREUM&&\"page_view_timing\"in NREUM.init&&\"enabled\"in NREUM.init.page_view_timing&&NREUM.init.page_view_timing.enabled===!1)){var u,s,d,p,l=t(\"handle\"),v=t(\"loader\"),m=t(8),g=t(3),y=NREUM.o.EV;if(\"PerformanceObserver\"in window&&\"function\"==typeof window.PerformanceObserver){s=new PerformanceObserver(r);try{s.observe({entryTypes:[\"paint\"]})}catch(h){}d=new PerformanceObserver(i);try{d.observe({entryTypes:[\"largest-contentful-paint\"]})}catch(h){}p=new PerformanceObserver(o);try{p.observe({type:\"layout-shift\",buffered:!0})}catch(h){}}if(\"addEventListener\"in document){var w=!1,b=[\"click\",\"keydown\",\"mousedown\",\"pointerdown\",\"touchstart\"];b.forEach(function(t){document.addEventListener(t,c,g(!1))})}m(f)}},{}],7:[function(t,e,n){function r(t,e){if(!i)return!1;if(t!==i)return!1;if(!e)return!0;if(!o)return!1;for(var n=o.split(\".\"),r=e.split(\".\"),a=0;a<r.length;a++)if(r[a]!==n[a])return!1;return!0}var i=null,o=null,a=/Version\\/(\\S+)\\s+Safari/;if(navigator.userAgent){var c=navigator.userAgent,f=c.match(a);f&&c.indexOf(\"Chrome\")===-1&&c.indexOf(\"Chromium\")===-1&&(i=\"Safari\",o=f[1])}e.exports={agent:i,version:o,match:r}},{}],8:[function(t,e,n){function r(t){function e(){t(c&&document[c]?document[c]:document[o]?\"hidden\":\"visible\")}\"addEventListener\"in document&&a&&document.addEventListener(a,e,i(!1))}var i=t(3);e.exports=r;var o,a,c;\"undefined\"!=typeof document.hidden?(o=\"hidden\",a=\"visibilitychange\",c=\"visibilityState\"):\"undefined\"!=typeof document.msHidden?(o=\"msHidden\",a=\"msvisibilitychange\"):\"undefined\"!=typeof document.webkitHidden&&(o=\"webkitHidden\",a=\"webkitvisibilitychange\",c=\"webkitVisibilityState\")},{}],9:[function(t,e,n){function r(t,e){var n=[],r=\"\",o=0;for(r in t)i.call(t,r)&&(n[o]=e(r,t[r]),o+=1);return n}var i=Object.prototype.hasOwnProperty;e.exports=r},{}],10:[function(t,e,n){function r(t,e,n){e||(e=0),\"undefined\"==typeof n&&(n=t?t.length:0);for(var r=-1,i=n-e||0,o=Array(i<0?0:i);++r<i;)o[r]=t[e+r];return o}e.exports=r},{}],11:[function(t,e,n){e.exports={exists:\"undefined\"!=typeof window.performance&&window.performance.timing&&\"undefined\"!=typeof window.performance.timing.navigationStart}},{}],ee:[function(t,e,n){function r(){}function i(t){function e(t){return t&&t instanceof r?t:t?u(t,f,a):a()}function n(n,r,i,o,a){if(a!==!1&&(a=!0),!l.aborted||o){t&&a&&t(n,r,i);for(var c=e(i),f=m(n),u=f.length,s=0;s<u;s++)f[s].apply(c,r);var p=d[w[n]];return p&&p.push([b,n,r,c]),c}}function o(t,e){h[t]=m(t).concat(e)}function v(t,e){var n=h[t];if(n)for(var r=0;r<n.length;r++)n[r]===e&&n.splice(r,1)}function m(t){return h[t]||[]}function g(t){return p[t]=p[t]||i(n)}function y(t,e){l.aborted||s(t,function(t,n){e=e||\"feature\",w[n]=e,e in d||(d[e]=[])})}var h={},w={},b={on:o,addEventListener:o,removeEventListener:v,emit:n,get:g,listeners:m,context:e,buffer:y,abort:c,aborted:!1};return b}function o(t){return u(t,f,a)}function a(){return new r}function c(){(d.api||d.feature)&&(l.aborted=!0,d=l.backlog={})}var f=\"nr@context\",u=t(\"gos\"),s=t(9),d={},p={},l=e.exports=i();e.exports.getOrSetContext=o,l.backlog=d},{}],gos:[function(t,e,n){function r(t,e,n){if(i.call(t,e))return t[e];var r=n();if(Object.defineProperty&&Object.keys)try{return Object.defineProperty(t,e,{value:r,writable:!0,enumerable:!1}),r}catch(o){}return t[e]=r,r}var i=Object.prototype.hasOwnProperty;e.exports=r},{}],handle:[function(t,e,n){function r(t,e,n,r){i.buffer([t],r),i.emit(t,e,n)}var i=t(\"ee\").get(\"handle\");e.exports=r,r.ee=i},{}],id:[function(t,e,n){function r(t){var e=typeof t;return!t||\"object\"!==e&&\"function\"!==e?-1:t===window?0:a(t,o,function(){return i++})}var i=1,o=\"nr@id\",a=t(\"gos\");e.exports=r},{}],loader:[function(t,e,n){function r(){if(!M++){var t=T.info=NREUM.info,e=m.getElementsByTagName(\"script\")[0];if(setTimeout(u.abort,3e4),!(t&&t.licenseKey&&t.applicationID&&e))return u.abort();f(x,function(e,n){t[e]||(t[e]=n)});var n=a();c(\"mark\",[\"onload\",n+T.offset],null,\"api\"),c(\"timing\",[\"load\",n]);var r=m.createElement(\"script\");0===t.agent.indexOf(\"http://\")||0===t.agent.indexOf(\"https://\")?r.src=t.agent:r.src=l+\"://\"+t.agent,e.parentNode.insertBefore(r,e)}}function i(){\"complete\"===m.readyState&&o()}function o(){c(\"mark\",[\"domContent\",a()+T.offset],null,\"api\")}var a=t(5),c=t(\"handle\"),f=t(9),u=t(\"ee\"),s=t(7),d=t(2),p=t(3),l=d.getConfiguration(\"ssl\")===!1?\"http\":\"https\",v=window,m=v.document,g=\"addEventListener\",y=\"attachEvent\",h=v.XMLHttpRequest,w=h&&h.prototype,b=!1;NREUM.o={ST:setTimeout,SI:v.setImmediate,CT:clearTimeout,XHR:h,REQ:v.Request,EV:v.Event,PR:v.Promise,MO:v.MutationObserver};var E=\"\"+location,x={beacon:\"bam.nr-data.net\",errorBeacon:\"bam.nr-data.net\",agent:\"js-agent.newrelic.com/nr-1216.min.js\"},O=h&&w&&w[g]&&!/CriOS/.test(navigator.userAgent),T=e.exports={offset:a.getLastTimestamp(),now:a,origin:E,features:{},xhrWrappable:O,userAgent:s,disabled:b};if(!b){t(1),t(6),m[g]?(m[g](\"DOMContentLoaded\",o,p(!1)),v[g](\"load\",r,p(!1))):(m[y](\"onreadystatechange\",i),v[y](\"onload\",r)),c(\"mark\",[\"firstbyte\",a.getLastTimestamp()],null,\"api\");var M=0}},{}],\"wrap-function\":[function(t,e,n){function r(t,e){function n(e,n,r,f,u){function nrWrapper(){var o,a,s,p;try{a=this,o=d(arguments),s=\"function\"==typeof r?r(o,a):r||{}}catch(l){i([l,\"\",[o,a,f],s],t)}c(n+\"start\",[o,a,f],s,u);try{return p=e.apply(a,o)}catch(v){throw c(n+\"err\",[o,a,v],s,u),v}finally{c(n+\"end\",[o,a,p],s,u)}}return a(e)?e:(n||(n=\"\"),nrWrapper[p]=e,o(e,nrWrapper,t),nrWrapper)}function r(t,e,r,i,o){r||(r=\"\");var c,f,u,s=\"-\"===r.charAt(0);for(u=0;u<e.length;u++)f=e[u],c=t[f],a(c)||(t[f]=n(c,s?f+r:r,i,f,o))}function c(n,r,o,a){if(!v||e){var c=v;v=!0;try{t.emit(n,r,o,e,a)}catch(f){i([f,n,r,o],t)}v=c}}return t||(t=s),n.inPlace=r,n.flag=p,n}function i(t,e){e||(e=s);try{e.emit(\"internal-error\",t)}catch(n){}}function o(t,e,n){if(Object.defineProperty&&Object.keys)try{var r=Object.keys(t);return r.forEach(function(n){Object.defineProperty(e,n,{get:function(){return t[n]},set:function(e){return t[n]=e,e}})}),e}catch(o){i([o],n)}for(var a in t)l.call(t,a)&&(e[a]=t[a]);return e}function a(t){return!(t&&t instanceof Function&&t.apply&&!t[p])}function c(t,e){var n=e(t);return n[p]=t,o(t,n,s),n}function f(t,e,n){var r=t[e];t[e]=c(r,n)}function u(){for(var t=arguments.length,e=new Array(t),n=0;n<t;++n)e[n]=arguments[n];return e}var s=t(\"ee\"),d=t(10),p=\"nr@original\",l=Object.prototype.hasOwnProperty,v=!1;e.exports=r,e.exports.wrapFunction=c,e.exports.wrapInPlace=f,e.exports.argsToArray=u},{}]},{},[\"loader\"]);Statement of Administration Policy: H.J. Res. 46 - Terminating the National Emergency Declared by the President on the Southern Border | The American Presidency Projectwindow.jQuery || document.write(\"<script src='/sites/default/modules/contrib/jquery_update/replace/jquery/1.11/jquery.min.js'>\\x3C/script>\")window.jQuery.ui || document.write(\"<script src='/sites/default/modules/contrib/jquery_update/replace/ui/ui/minified/jquery-ui.min.js'>\\x3C/script>\")(function(i,s,o,g,r,a,m){i[\"GoogleAnalyticsObject\"]=r;i[r]=i[r]||function(){(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)})(window,document,\"script\",\"https://www.google-analytics.com/analytics.js\",\"ga\");ga(\"create\", \"UA-86410002-1\", {\"cookieDomain\":\"auto\",\"allowLinker\":true});ga(\"require\", \"linker\");ga(\"linker:autoLink\", [\"dev-wwwpresidencyucsbedu.pantheonsite.io\",\"www.presidency.ucsb.edu\"]);ga(\"set\", \"anonymizeIp\", true);ga(\"send\", \"pageview\");jQuery.extend(Drupal.settings, {\"basePath\":\"\\/\",\"pathPrefix\":\"\",\"setHasJsCookie\":0,\"ajaxPageState\":{\"theme\":\"app\",\"theme_token\":\"GvyOnyVaJM7HUSblJ51c6dck1-9Opx0JuM2RwYAMUPk\",\"js\":{\"sites\\/default\\/libraries\\/jquery-ui-multiselect-widget\\/src\\/jquery.multiselect.js\":1,\"sites\\/default\\/libraries\\/jquery-ui-multiselect-widget\\/src\\/jquery.multiselect.filter.js\":1,\"sites\\/default\\/modules\\/contrib\\/jquery_ui_multiselect_widget\\/jquery_ui_multiselect_widget.js\":1,\"modules\\/statistics\\/statistics.js\":1,\"sites\\/default\\/themes\\/bootstrap\\/js\\/bootstrap.js\":1,\"\\/\\/ajax.aspnetcdn.com\\/ajax\\/jQuery\\/jquery-1.11.2.min.js\":1,\"0\":1,\"misc\\/jquery-extend-3.4.0.js\":1,\"misc\\/jquery-html-prefilter-3.5.0-backport.js\":1,\"misc\\/jquery.once.js\":1,\"misc\\/drupal.js\":1,\"\\/\\/ajax.aspnetcdn.com\\/ajax\\/jquery.ui\\/1.11.4\\/jquery-ui.min.js\":1,\"1\":1,\"sites\\/default\\/modules\\/contrib\\/extlink\\/extlink.js\":1,\"sites\\/default\\/modules\\/contrib\\/better_exposed_filters\\/better_exposed_filters.js\":1,\"sites\\/default\\/modules\\/contrib\\/google_analytics\\/googleanalytics.js\":1,\"2\":1,\"sites\\/default\\/modules\\/contrib\\/field_group\\/field_group.js\":1,\"sites\\/default\\/modules\\/contrib\\/rrssb\\/rrssb.init.js\":1,\"sites\\/default\\/libraries\\/rrssb-plus\\/js\\/rrssb.min.js\":1,\"sites\\/default\\/themes\\/app\\/bootstrap\\/js\\/affix.js\":1,\"sites\\/default\\/themes\\/app\\/bootstrap\\/js\\/alert.js\":1,\"sites\\/default\\/themes\\/app\\/bootstrap\\/js\\/button.js\":1,\"sites\\/default\\/themes\\/app\\/bootstrap\\/js\\/carousel.js\":1,\"sites\\/default\\/themes\\/app\\/bootstrap\\/js\\/collapse.js\":1,\"sites\\/default\\/themes\\/app\\/bootstrap\\/js\\/dropdown.js\":1,\"sites\\/default\\/themes\\/app\\/bootstrap\\/js\\/modal.js\":1,\"sites\\/default\\/themes\\/app\\/bootstrap\\/js\\/tooltip.js\":1,\"sites\\/default\\/themes\\/app\\/bootstrap\\/js\\/popover.js\":1,\"sites\\/default\\/themes\\/app\\/bootstrap\\/js\\/scrollspy.js\":1,\"sites\\/default\\/themes\\/app\\/bootstrap\\/js\\/tab.js\":1,\"sites\\/default\\/themes\\/app\\/bootstrap\\/js\\/transition.js\":1,\"sites\\/default\\/themes\\/app\\/scripts\\/scripts.js\":1},\"css\":{\"modules\\/system\\/system.base.css\":1,\"misc\\/ui\\/jquery.ui.core.css\":1,\"misc\\/ui\\/jquery.ui.theme.css\":1,\"misc\\/ui\\/jquery.ui.accordion.css\":1,\"sites\\/default\\/modules\\/contrib\\/date\\/date_api\\/date.css\":1,\"sites\\/default\\/modules\\/contrib\\/date\\/date_popup\\/themes\\/datepicker.1.7.css\":1,\"sites\\/default\\/modules\\/contrib\\/date\\/date_repeat_field\\/date_repeat_field.css\":1,\"modules\\/field\\/theme\\/field.css\":1,\"modules\\/node\\/node.css\":1,\"sites\\/default\\/modules\\/contrib\\/extlink\\/extlink.css\":1,\"sites\\/default\\/modules\\/contrib\\/views\\/css\\/views.css\":1,\"sites\\/default\\/modules\\/contrib\\/ctools\\/css\\/ctools.css\":1,\"sites\\/default\\/libraries\\/jquery-ui-multiselect-widget\\/jquery.multiselect.css\":1,\"sites\\/default\\/libraries\\/jquery-ui-multiselect-widget\\/jquery.multiselect.filter.css\":1,\"sites\\/default\\/modules\\/contrib\\/jquery_ui_multiselect_widget\\/jquery_ui_multiselect_widget.css\":1,\"sites\\/default\\/modules\\/contrib\\/vefl\\/css\\/vefl-layouts.css\":1,\"public:\\/\\/rrssb\\/rrssb.4e2262bd.css\":1,\"sites\\/default\\/libraries\\/rrssb-plus\\/css\\/rrssb.css\":1,\"sites\\/default\\/themes\\/app\\/css\\/style.css\":1,\"sites\\/default\\/themes\\/app\\/css\\/oog.css\":1,\"sites\\/default\\/themes\\/app\\/css\\/print.css\":1}},\"jquery_ui_multiselect_widget\":{\"module_path\":\"sites\\/default\\/modules\\/contrib\\/jquery_ui_multiselect_widget\",\"multiple\":1,\"filter\":1,\"subselector\":\"#edit-category2\",\"selectedlist\":\"4\",\"autoOpen\":0,\"header\":1,\"height\":\"auto\",\"classes\":\"app-uberselect\",\"filter_auto_reset\":1,\"filter_width\":\"auto\",\"jquery_ui_multiselect_widget_path_match_exclude\":\"admin\\/*\\r\\nmedia\\/*\\r\\nfile\\/*\\r\\nsystem\\/ajax\"},\"better_exposed_filters\":{\"datepicker\":false,\"slider\":false,\"settings\":[],\"autosubmit\":false,\"views\":{\"dpg_docs_media\":{\"displays\":{\"block_2\":{\"filters\":[]}}},\"report_a_typo\":{\"displays\":{\"block\":{\"filters\":[]}}},\"document_attached_files\":{\"displays\":{\"block\":{\"filters\":[]},\"block_1\":{\"filters\":[]}}}}},\"urlIsAjaxTrusted\":{\"\\/advanced-search\":true},\"extlink\":{\"extTarget\":\"_blank\",\"extClass\":0,\"extLabel\":\"(link is external)\",\"extImgClass\":0,\"extIconPlacement\":\"append\",\"extSubdomains\":1,\"extExclude\":\"\",\"extInclude\":\"\",\"extCssExclude\":\"\",\"extCssExplicit\":\"\",\"extAlert\":0,\"extAlertText\":\"This link will take you to an external web site.\",\"mailtoClass\":0,\"mailtoLabel\":\"(link sends e-mail)\"},\"googleanalytics\":{\"trackOutbound\":1,\"trackMailto\":1,\"trackDownload\":1,\"trackDownloadExtensions\":\"7z|aac|arc|arj|asf|asx|avi|bin|csv|doc(x|m)?|dot(x|m)?|exe|flv|gif|gz|gzip|hqx|jar|jpe?g|js|mp(2|3|4|e?g)|mov(ie)?|msi|msp|pdf|phps|png|ppt(x|m)?|pot(x|m)?|pps(x|m)?|ppam|sld(x|m)?|thmx|qtm?|ra(m|r)?|sea|sit|tar|tgz|torrent|txt|wav|wma|wmv|wpd|xls(x|m|b)?|xlt(x|m)|xlam|xml|z|zip\",\"trackDomainMode\":2,\"trackCrossDomains\":[\"dev-wwwpresidencyucsbedu.pantheonsite.io\",\"www.presidency.ucsb.edu\"]},\"statistics\":{\"data\":{\"nid\":\"335315\"},\"url\":\"\\/modules\\/statistics\\/statistics.php\"},\"field_group\":{\"div\":\"full\"},\"rrssb\":{\"size\":\"1\",\"shrink\":\"1\",\"regrow\":\"\",\"minRows\":\"1\",\"maxRows\":\"1\",\"prefixReserve\":\"1em\",\"prefixHide\":\"1em\",\"alignRight\":0},\"bootstrap\":{\"anchorsFix\":1,\"anchorsSmoothScrolling\":1,\"formHasError\":1,\"popoverEnabled\":0,\"popoverOptions\":{\"animation\":1,\"html\":0,\"placement\":\"right\",\"selector\":\"\",\"trigger\":\"click\",\"triggerAutoclose\":1,\"title\":\"\",\"content\":\"\",\"delay\":0,\"container\":\"body\"},\"tooltipEnabled\":1,\"tooltipOptions\":{\"animation\":1,\"html\":0,\"placement\":\"auto left\",\"selector\":\"\",\"trigger\":\"hover focus\",\"delay\":0,\"container\":\"body\"}}});"
## [2] ""
## [3] "(window.NREUM||(NREUM={})).init={ajax:{deny_list:[\"bam-cell.nr-data.net\"]}};(window.NREUM||(NREUM={})).loader_config={licenseKey:\"dee899de70\",applicationID:\"80106271\"};window.NREUM||(NREUM={}),__nr_require=function(t,e,n){function r(n){if(!e[n]){var i=e[n]={exports:{}};t[n][0].call(i.exports,function(e){var i=t[n][1][e];return r(i||e)},i,i.exports)}return e[n].exports}if(\"function\"==typeof __nr_require)return __nr_require;for(var i=0;i<n.length;i++)r(n[i]);return r}({1:[function(t,e,n){function r(){}function i(t,e,n,r){return function(){return s.recordSupportability(\"API/\"+e+\"/called\"),o(t+e,[u.now()].concat(c(arguments)),n?null:this,r),n?void 0:this}}var o=t(\"handle\"),a=t(9),c=t(10),f=t(\"ee\").get(\"tracer\"),u=t(\"loader\"),s=t(4),d=NREUM;\"undefined\"==typeof window.newrelic&&(newrelic=d);var p=[\"setPageViewName\",\"setCustomAttribute\",\"setErrorHandler\",\"finished\",\"addToTrace\",\"inlineHit\",\"addRelease\"],l=\"api-\",v=l+\"ixn-\";a(p,function(t,e){d[e]=i(l,e,!0,\"api\")}),d.addPageAction=i(l,\"addPageAction\",!0),d.setCurrentRouteName=i(l,\"routeName\",!0),e.exports=newrelic,d.interaction=function(){return(new r).get()};var m=r.prototype={createTracer:function(t,e){var n={},r=this,i=\"function\"==typeof e;return o(v+\"tracer\",[u.now(),t,n],r),function(){if(f.emit((i?\"\":\"no-\")+\"fn-start\",[u.now(),r,i],n),i)try{return e.apply(this,arguments)}catch(t){throw f.emit(\"fn-err\",[arguments,this,t],n),t}finally{f.emit(\"fn-end\",[u.now()],n)}}}};a(\"actionText,setName,setAttribute,save,ignore,onEnd,getContext,end,get\".split(\",\"),function(t,e){m[e]=i(v,e)}),newrelic.noticeError=function(t,e){\"string\"==typeof t&&(t=new Error(t)),s.recordSupportability(\"API/noticeError/called\"),o(\"err\",[t,u.now(),!1,e])}},{}],2:[function(t,e,n){function r(t){if(NREUM.init){for(var e=NREUM.init,n=t.split(\".\"),r=0;r<n.length-1;r++)if(e=e[n[r]],\"object\"!=typeof e)return;return e=e[n[n.length-1]]}}e.exports={getConfiguration:r}},{}],3:[function(t,e,n){var r=!1;try{var i=Object.defineProperty({},\"passive\",{get:function(){r=!0}});window.addEventListener(\"testPassive\",null,i),window.removeEventListener(\"testPassive\",null,i)}catch(o){}e.exports=function(t){return r?{passive:!0,capture:!!t}:!!t}},{}],4:[function(t,e,n){function r(t,e){var n=[a,t,{name:t},e];return o(\"storeMetric\",n,null,\"api\"),n}function i(t,e){var n=[c,t,{name:t},e];return o(\"storeEventMetrics\",n,null,\"api\"),n}var o=t(\"handle\"),a=\"sm\",c=\"cm\";e.exports={constants:{SUPPORTABILITY_METRIC:a,CUSTOM_METRIC:c},recordSupportability:r,recordCustom:i}},{}],5:[function(t,e,n){function r(){return c.exists&&performance.now?Math.round(performance.now()):(o=Math.max((new Date).getTime(),o))-a}function i(){return o}var o=(new Date).getTime(),a=o,c=t(11);e.exports=r,e.exports.offset=a,e.exports.getLastTimestamp=i},{}],6:[function(t,e,n){function r(t,e){var n=t.getEntries();n.forEach(function(t){\"first-paint\"===t.name?l(\"timing\",[\"fp\",Math.floor(t.startTime)]):\"first-contentful-paint\"===t.name&&l(\"timing\",[\"fcp\",Math.floor(t.startTime)])})}function i(t,e){var n=t.getEntries();if(n.length>0){var r=n[n.length-1];if(u&&u<r.startTime)return;var i=[r],o=a({});o&&i.push(o),l(\"lcp\",i)}}function o(t){t.getEntries().forEach(function(t){t.hadRecentInput||l(\"cls\",[t])})}function a(t){var e=navigator.connection||navigator.mozConnection||navigator.webkitConnection;if(e)return e.type&&(t[\"net-type\"]=e.type),e.effectiveType&&(t[\"net-etype\"]=e.effectiveType),e.rtt&&(t[\"net-rtt\"]=e.rtt),e.downlink&&(t[\"net-dlink\"]=e.downlink),t}function c(t){if(t instanceof y&&!w){var e=Math.round(t.timeStamp),n={type:t.type};a(n),e<=v.now()?n.fid=v.now()-e:e>v.offset&&e<=Date.now()?(e-=v.offset,n.fid=v.now()-e):e=v.now(),w=!0,l(\"timing\",[\"fi\",e,n])}}function f(t){\"hidden\"===t&&(u=v.now(),l(\"pageHide\",[u]))}if(!(\"init\"in NREUM&&\"page_view_timing\"in NREUM.init&&\"enabled\"in NREUM.init.page_view_timing&&NREUM.init.page_view_timing.enabled===!1)){var u,s,d,p,l=t(\"handle\"),v=t(\"loader\"),m=t(8),g=t(3),y=NREUM.o.EV;if(\"PerformanceObserver\"in window&&\"function\"==typeof window.PerformanceObserver){s=new PerformanceObserver(r);try{s.observe({entryTypes:[\"paint\"]})}catch(h){}d=new PerformanceObserver(i);try{d.observe({entryTypes:[\"largest-contentful-paint\"]})}catch(h){}p=new PerformanceObserver(o);try{p.observe({type:\"layout-shift\",buffered:!0})}catch(h){}}if(\"addEventListener\"in document){var w=!1,b=[\"click\",\"keydown\",\"mousedown\",\"pointerdown\",\"touchstart\"];b.forEach(function(t){document.addEventListener(t,c,g(!1))})}m(f)}},{}],7:[function(t,e,n){function r(t,e){if(!i)return!1;if(t!==i)return!1;if(!e)return!0;if(!o)return!1;for(var n=o.split(\".\"),r=e.split(\".\"),a=0;a<r.length;a++)if(r[a]!==n[a])return!1;return!0}var i=null,o=null,a=/Version\\/(\\S+)\\s+Safari/;if(navigator.userAgent){var c=navigator.userAgent,f=c.match(a);f&&c.indexOf(\"Chrome\")===-1&&c.indexOf(\"Chromium\")===-1&&(i=\"Safari\",o=f[1])}e.exports={agent:i,version:o,match:r}},{}],8:[function(t,e,n){function r(t){function e(){t(c&&document[c]?document[c]:document[o]?\"hidden\":\"visible\")}\"addEventListener\"in document&&a&&document.addEventListener(a,e,i(!1))}var i=t(3);e.exports=r;var o,a,c;\"undefined\"!=typeof document.hidden?(o=\"hidden\",a=\"visibilitychange\",c=\"visibilityState\"):\"undefined\"!=typeof document.msHidden?(o=\"msHidden\",a=\"msvisibilitychange\"):\"undefined\"!=typeof document.webkitHidden&&(o=\"webkitHidden\",a=\"webkitvisibilitychange\",c=\"webkitVisibilityState\")},{}],9:[function(t,e,n){function r(t,e){var n=[],r=\"\",o=0;for(r in t)i.call(t,r)&&(n[o]=e(r,t[r]),o+=1);return n}var i=Object.prototype.hasOwnProperty;e.exports=r},{}],10:[function(t,e,n){function r(t,e,n){e||(e=0),\"undefined\"==typeof n&&(n=t?t.length:0);for(var r=-1,i=n-e||0,o=Array(i<0?0:i);++r<i;)o[r]=t[e+r];return o}e.exports=r},{}],11:[function(t,e,n){e.exports={exists:\"undefined\"!=typeof window.performance&&window.performance.timing&&\"undefined\"!=typeof window.performance.timing.navigationStart}},{}],ee:[function(t,e,n){function r(){}function i(t){function e(t){return t&&t instanceof r?t:t?u(t,f,a):a()}function n(n,r,i,o,a){if(a!==!1&&(a=!0),!l.aborted||o){t&&a&&t(n,r,i);for(var c=e(i),f=m(n),u=f.length,s=0;s<u;s++)f[s].apply(c,r);var p=d[w[n]];return p&&p.push([b,n,r,c]),c}}function o(t,e){h[t]=m(t).concat(e)}function v(t,e){var n=h[t];if(n)for(var r=0;r<n.length;r++)n[r]===e&&n.splice(r,1)}function m(t){return h[t]||[]}function g(t){return p[t]=p[t]||i(n)}function y(t,e){l.aborted||s(t,function(t,n){e=e||\"feature\",w[n]=e,e in d||(d[e]=[])})}var h={},w={},b={on:o,addEventListener:o,removeEventListener:v,emit:n,get:g,listeners:m,context:e,buffer:y,abort:c,aborted:!1};return b}function o(t){return u(t,f,a)}function a(){return new r}function c(){(d.api||d.feature)&&(l.aborted=!0,d=l.backlog={})}var f=\"nr@context\",u=t(\"gos\"),s=t(9),d={},p={},l=e.exports=i();e.exports.getOrSetContext=o,l.backlog=d},{}],gos:[function(t,e,n){function r(t,e,n){if(i.call(t,e))return t[e];var r=n();if(Object.defineProperty&&Object.keys)try{return Object.defineProperty(t,e,{value:r,writable:!0,enumerable:!1}),r}catch(o){}return t[e]=r,r}var i=Object.prototype.hasOwnProperty;e.exports=r},{}],handle:[function(t,e,n){function r(t,e,n,r){i.buffer([t],r),i.emit(t,e,n)}var i=t(\"ee\").get(\"handle\");e.exports=r,r.ee=i},{}],id:[function(t,e,n){function r(t){var e=typeof t;return!t||\"object\"!==e&&\"function\"!==e?-1:t===window?0:a(t,o,function(){return i++})}var i=1,o=\"nr@id\",a=t(\"gos\");e.exports=r},{}],loader:[function(t,e,n){function r(){if(!M++){var t=T.info=NREUM.info,e=m.getElementsByTagName(\"script\")[0];if(setTimeout(u.abort,3e4),!(t&&t.licenseKey&&t.applicationID&&e))return u.abort();f(x,function(e,n){t[e]||(t[e]=n)});var n=a();c(\"mark\",[\"onload\",n+T.offset],null,\"api\"),c(\"timing\",[\"load\",n]);var r=m.createElement(\"script\");0===t.agent.indexOf(\"http://\")||0===t.agent.indexOf(\"https://\")?r.src=t.agent:r.src=l+\"://\"+t.agent,e.parentNode.insertBefore(r,e)}}function i(){\"complete\"===m.readyState&&o()}function o(){c(\"mark\",[\"domContent\",a()+T.offset],null,\"api\")}var a=t(5),c=t(\"handle\"),f=t(9),u=t(\"ee\"),s=t(7),d=t(2),p=t(3),l=d.getConfiguration(\"ssl\")===!1?\"http\":\"https\",v=window,m=v.document,g=\"addEventListener\",y=\"attachEvent\",h=v.XMLHttpRequest,w=h&&h.prototype,b=!1;NREUM.o={ST:setTimeout,SI:v.setImmediate,CT:clearTimeout,XHR:h,REQ:v.Request,EV:v.Event,PR:v.Promise,MO:v.MutationObserver};var E=\"\"+location,x={beacon:\"bam.nr-data.net\",errorBeacon:\"bam.nr-data.net\",agent:\"js-agent.newrelic.com/nr-1216.min.js\"},O=h&&w&&w[g]&&!/CriOS/.test(navigator.userAgent),T=e.exports={offset:a.getLastTimestamp(),now:a,origin:E,features:{},xhrWrappable:O,userAgent:s,disabled:b};if(!b){t(1),t(6),m[g]?(m[g](\"DOMContentLoaded\",o,p(!1)),v[g](\"load\",r,p(!1))):(m[y](\"onreadystatechange\",i),v[y](\"onload\",r)),c(\"mark\",[\"firstbyte\",a.getLastTimestamp()],null,\"api\");var M=0}},{}],\"wrap-function\":[function(t,e,n){function r(t,e){function n(e,n,r,f,u){function nrWrapper(){var o,a,s,p;try{a=this,o=d(arguments),s=\"function\"==typeof r?r(o,a):r||{}}catch(l){i([l,\"\",[o,a,f],s],t)}c(n+\"start\",[o,a,f],s,u);try{return p=e.apply(a,o)}catch(v){throw c(n+\"err\",[o,a,v],s,u),v}finally{c(n+\"end\",[o,a,p],s,u)}}return a(e)?e:(n||(n=\"\"),nrWrapper[p]=e,o(e,nrWrapper,t),nrWrapper)}function r(t,e,r,i,o){r||(r=\"\");var c,f,u,s=\"-\"===r.charAt(0);for(u=0;u<e.length;u++)f=e[u],c=t[f],a(c)||(t[f]=n(c,s?f+r:r,i,f,o))}function c(n,r,o,a){if(!v||e){var c=v;v=!0;try{t.emit(n,r,o,e,a)}catch(f){i([f,n,r,o],t)}v=c}}return t||(t=s),n.inPlace=r,n.flag=p,n}function i(t,e){e||(e=s);try{e.emit(\"internal-error\",t)}catch(n){}}function o(t,e,n){if(Object.defineProperty&&Object.keys)try{var r=Object.keys(t);return r.forEach(function(n){Object.defineProperty(e,n,{get:function(){return t[n]},set:function(e){return t[n]=e,e}})}),e}catch(o){i([o],n)}for(var a in t)l.call(t,a)&&(e[a]=t[a]);return e}function a(t){return!(t&&t instanceof Function&&t.apply&&!t[p])}function c(t,e){var n=e(t);return n[p]=t,o(t,n,s),n}function f(t,e,n){var r=t[e];t[e]=c(r,n)}function u(){for(var t=arguments.length,e=new Array(t),n=0;n<t;++n)e[n]=arguments[n];return e}var s=t(\"ee\"),d=t(10),p=\"nr@original\",l=Object.prototype.hasOwnProperty,v=!1;e.exports=r,e.exports.wrapFunction=c,e.exports.wrapInPlace=f,e.exports.argsToArray=u},{}]},{},[\"loader\"]);"
## [4] ""
## [5] ""
## [6] ""
## [7] ""
## [8] ""
## [9] ""
## [10] "Statement of Administration Policy: H.J. Res. 46 - Terminating the National Emergency Declared by the President on the Southern Border | The American Presidency Project"
## [11] ""
## [12] ""
## [13] ""
## [14] ""
## [15] ""
## [16] ""
## [17] ""
## [18] ""
## [19] ""
## [20] "window.jQuery || document.write(\"<script src='/sites/default/modules/contrib/jquery_update/replace/jquery/1.11/jquery.min.js'>\\x3C/script>\")"
## [21] ""
## [22] ""
## [23] "window.jQuery.ui || document.write(\"<script src='/sites/default/modules/contrib/jquery_update/replace/ui/ui/minified/jquery-ui.min.js'>\\x3C/script>\")"
## [24] ""
## [25] ""
## [26] "(function(i,s,o,g,r,a,m){i[\"GoogleAnalyticsObject\"]=r;i[r]=i[r]||function(){(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)})(window,document,\"script\",\"https://www.google-analytics.com/analytics.js\",\"ga\");ga(\"create\", \"UA-86410002-1\", {\"cookieDomain\":\"auto\",\"allowLinker\":true});ga(\"require\", \"linker\");ga(\"linker:autoLink\", [\"dev-wwwpresidencyucsbedu.pantheonsite.io\",\"www.presidency.ucsb.edu\"]);ga(\"set\", \"anonymizeIp\", true);ga(\"send\", \"pageview\");"
## [27] ""
## [28] ""
## [29] "jQuery.extend(Drupal.settings, {\"basePath\":\"\\/\",\"pathPrefix\":\"\",\"setHasJsCookie\":0,\"ajaxPageState\":{\"theme\":\"app\",\"theme_token\":\"GvyOnyVaJM7HUSblJ51c6dck1-9Opx0JuM2RwYAMUPk\",\"js\":{\"sites\\/default\\/libraries\\/jquery-ui-multiselect-widget\\/src\\/jquery.multiselect.js\":1,\"sites\\/default\\/libraries\\/jquery-ui-multiselect-widget\\/src\\/jquery.multiselect.filter.js\":1,\"sites\\/default\\/modules\\/contrib\\/jquery_ui_multiselect_widget\\/jquery_ui_multiselect_widget.js\":1,\"modules\\/statistics\\/statistics.js\":1,\"sites\\/default\\/themes\\/bootstrap\\/js\\/bootstrap.js\":1,\"\\/\\/ajax.aspnetcdn.com\\/ajax\\/jQuery\\/jquery-1.11.2.min.js\":1,\"0\":1,\"misc\\/jquery-extend-3.4.0.js\":1,\"misc\\/jquery-html-prefilter-3.5.0-backport.js\":1,\"misc\\/jquery.once.js\":1,\"misc\\/drupal.js\":1,\"\\/\\/ajax.aspnetcdn.com\\/ajax\\/jquery.ui\\/1.11.4\\/jquery-ui.min.js\":1,\"1\":1,\"sites\\/default\\/modules\\/contrib\\/extlink\\/extlink.js\":1,\"sites\\/default\\/modules\\/contrib\\/better_exposed_filters\\/better_exposed_filters.js\":1,\"sites\\/default\\/modules\\/contrib\\/google_analytics\\/googleanalytics.js\":1,\"2\":1,\"sites\\/default\\/modules\\/contrib\\/field_group\\/field_group.js\":1,\"sites\\/default\\/modules\\/contrib\\/rrssb\\/rrssb.init.js\":1,\"sites\\/default\\/libraries\\/rrssb-plus\\/js\\/rrssb.min.js\":1,\"sites\\/default\\/themes\\/app\\/bootstrap\\/js\\/affix.js\":1,\"sites\\/default\\/themes\\/app\\/bootstrap\\/js\\/alert.js\":1,\"sites\\/default\\/themes\\/app\\/bootstrap\\/js\\/button.js\":1,\"sites\\/default\\/themes\\/app\\/bootstrap\\/js\\/carousel.js\":1,\"sites\\/default\\/themes\\/app\\/bootstrap\\/js\\/collapse.js\":1,\"sites\\/default\\/themes\\/app\\/bootstrap\\/js\\/dropdown.js\":1,\"sites\\/default\\/themes\\/app\\/bootstrap\\/js\\/modal.js\":1,\"sites\\/default\\/themes\\/app\\/bootstrap\\/js\\/tooltip.js\":1,\"sites\\/default\\/themes\\/app\\/bootstrap\\/js\\/popover.js\":1,\"sites\\/default\\/themes\\/app\\/bootstrap\\/js\\/scrollspy.js\":1,\"sites\\/default\\/themes\\/app\\/bootstrap\\/js\\/tab.js\":1,\"sites\\/default\\/themes\\/app\\/bootstrap\\/js\\/transition.js\":1,\"sites\\/default\\/themes\\/app\\/scripts\\/scripts.js\":1},\"css\":{\"modules\\/system\\/system.base.css\":1,\"misc\\/ui\\/jquery.ui.core.css\":1,\"misc\\/ui\\/jquery.ui.theme.css\":1,\"misc\\/ui\\/jquery.ui.accordion.css\":1,\"sites\\/default\\/modules\\/contrib\\/date\\/date_api\\/date.css\":1,\"sites\\/default\\/modules\\/contrib\\/date\\/date_popup\\/themes\\/datepicker.1.7.css\":1,\"sites\\/default\\/modules\\/contrib\\/date\\/date_repeat_field\\/date_repeat_field.css\":1,\"modules\\/field\\/theme\\/field.css\":1,\"modules\\/node\\/node.css\":1,\"sites\\/default\\/modules\\/contrib\\/extlink\\/extlink.css\":1,\"sites\\/default\\/modules\\/contrib\\/views\\/css\\/views.css\":1,\"sites\\/default\\/modules\\/contrib\\/ctools\\/css\\/ctools.css\":1,\"sites\\/default\\/libraries\\/jquery-ui-multiselect-widget\\/jquery.multiselect.css\":1,\"sites\\/default\\/libraries\\/jquery-ui-multiselect-widget\\/jquery.multiselect.filter.css\":1,\"sites\\/default\\/modules\\/contrib\\/jquery_ui_multiselect_widget\\/jquery_ui_multiselect_widget.css\":1,\"sites\\/default\\/modules\\/contrib\\/vefl\\/css\\/vefl-layouts.css\":1,\"public:\\/\\/rrssb\\/rrssb.4e2262bd.css\":1,\"sites\\/default\\/libraries\\/rrssb-plus\\/css\\/rrssb.css\":1,\"sites\\/default\\/themes\\/app\\/css\\/style.css\":1,\"sites\\/default\\/themes\\/app\\/css\\/oog.css\":1,\"sites\\/default\\/themes\\/app\\/css\\/print.css\":1}},\"jquery_ui_multiselect_widget\":{\"module_path\":\"sites\\/default\\/modules\\/contrib\\/jquery_ui_multiselect_widget\",\"multiple\":1,\"filter\":1,\"subselector\":\"#edit-category2\",\"selectedlist\":\"4\",\"autoOpen\":0,\"header\":1,\"height\":\"auto\",\"classes\":\"app-uberselect\",\"filter_auto_reset\":1,\"filter_width\":\"auto\",\"jquery_ui_multiselect_widget_path_match_exclude\":\"admin\\/*\\r\\nmedia\\/*\\r\\nfile\\/*\\r\\nsystem\\/ajax\"},\"better_exposed_filters\":{\"datepicker\":false,\"slider\":false,\"settings\":[],\"autosubmit\":false,\"views\":{\"dpg_docs_media\":{\"displays\":{\"block_2\":{\"filters\":[]}}},\"report_a_typo\":{\"displays\":{\"block\":{\"filters\":[]}}},\"document_attached_files\":{\"displays\":{\"block\":{\"filters\":[]},\"block_1\":{\"filters\":[]}}}}},\"urlIsAjaxTrusted\":{\"\\/advanced-search\":true},\"extlink\":{\"extTarget\":\"_blank\",\"extClass\":0,\"extLabel\":\"(link is external)\",\"extImgClass\":0,\"extIconPlacement\":\"append\",\"extSubdomains\":1,\"extExclude\":\"\",\"extInclude\":\"\",\"extCssExclude\":\"\",\"extCssExplicit\":\"\",\"extAlert\":0,\"extAlertText\":\"This link will take you to an external web site.\",\"mailtoClass\":0,\"mailtoLabel\":\"(link sends e-mail)\"},\"googleanalytics\":{\"trackOutbound\":1,\"trackMailto\":1,\"trackDownload\":1,\"trackDownloadExtensions\":\"7z|aac|arc|arj|asf|asx|avi|bin|csv|doc(x|m)?|dot(x|m)?|exe|flv|gif|gz|gzip|hqx|jar|jpe?g|js|mp(2|3|4|e?g)|mov(ie)?|msi|msp|pdf|phps|png|ppt(x|m)?|pot(x|m)?|pps(x|m)?|ppam|sld(x|m)?|thmx|qtm?|ra(m|r)?|sea|sit|tar|tgz|torrent|txt|wav|wma|wmv|wpd|xls(x|m|b)?|xlt(x|m)|xlam|xml|z|zip\",\"trackDomainMode\":2,\"trackCrossDomains\":[\"dev-wwwpresidencyucsbedu.pantheonsite.io\",\"www.presidency.ucsb.edu\"]},\"statistics\":{\"data\":{\"nid\":\"335315\"},\"url\":\"\\/modules\\/statistics\\/statistics.php\"},\"field_group\":{\"div\":\"full\"},\"rrssb\":{\"size\":\"1\",\"shrink\":\"1\",\"regrow\":\"\",\"minRows\":\"1\",\"maxRows\":\"1\",\"prefixReserve\":\"1em\",\"prefixHide\":\"1em\",\"alignRight\":0},\"bootstrap\":{\"anchorsFix\":1,\"anchorsSmoothScrolling\":1,\"formHasError\":1,\"popoverEnabled\":0,\"popoverOptions\":{\"animation\":1,\"html\":0,\"placement\":\"right\",\"selector\":\"\",\"trigger\":\"click\",\"triggerAutoclose\":1,\"title\":\"\",\"content\":\"\",\"delay\":0,\"container\":\"body\"},\"tooltipEnabled\":1,\"tooltipOptions\":{\"animation\":1,\"html\":0,\"placement\":\"auto left\",\"selector\":\"\",\"trigger\":\"hover focus\",\"delay\":0,\"container\":\"body\"}}});"
## [30] "\n \n Skip to main content\n \n \n\n \n \n \n The American Presidency Project\n\nAbout Search\n\n\n\n \n \n \n \n \n \n\n \n \n Toggle navigation\n \n \n \n \n \n\n \n Documents Guidebook\nCategory Attributes\n\nStatistics\nMedia Archive\nPresidents\nAnalyses\nGIVE\n\n \n \n\n \n \n\n \n \n\n \n Documents\n \n \n Archive Guidebook\nCategories\nAttributes\n\n\nCategories\n \n \n Presidential (227224) Correspondents' Association (32)\nEulogies (62)\nExecutive Orders (6303)\nFireside Chats (27)\nInterviews (958)\nLetters (4626)\nMiscellaneous Remarks (15435)\nMiscellaneous Written (842)\nNews Conferences (2481)\nSigning Statements (2145)\nSpoken Addresses and Remarks (18603)\nFarewell Address (11)\nInaugural Addresses (62)\nMemoranda (3123)\nMessages (11339)\nOral Address (631)\nProclamations (8720)\nSaturday Weekly Addresses (Radio and Webcast) (1639)\nState Dinners (953)\nState of the Union Addresses (98)\nState of the Union Messages (140)\nStatements (13673)\nVetoes (1201)\nWritten Messages (23777)\nWritten Presidential Orders (33338)\n\nPress/Media (17648) Press Briefings (6698)\n\nElections and Transitions (24542) Campaign Documents (4518)\nConvention Speeches (81)\nDebates (171)\nParty Platforms (103)\nTransition Documents (552)\n\nMiscellaneous (430) Opposition Party Responses (33)\nPost Presidential Remarks (10)\n\nCongressional (38)\n\n\n\n \n \n \n \n \n \n \n \n \n \n\n \n \n \n \n\n \n Donald J. Trump \n\n \n \n \n 45th President of the United States: 2017 - 2021\n \n \n\n \n Statement of Administration Policy: H.J. Res. 46 - Terminating the National Emergency Declared by the President on the Southern Border\n \n\n\n \n\n \n February 26, 2019 \n\n \n STATEMENT OF ADMINISTRATION POLICY\n(House)(Rep. Castro, D-TX, and 233 cosponsors)\nThe Administration strongly opposes H.J. Res. 46. The current situation at the Southern Border presents a humanitarian and security crisis that threatens core national security interests and constitutes a national emergency. The Southern Border is a major entry point for criminals, gang members, and illicit narcotics. The problem of large-scale unlawful migration through the Southern Border is enduring, and, despite the Administration's use of existing statutory authorities, in recent years the situation has worsened in certain respects. In particular, we have recently seen sharp increases in the number of illegal entrances into the United States of family units, unaccompanied minors, and persons claiming a fear of return—aliens whom the Administration is largely unable to detain or remove because of antiquated laws and problematic court decisions.\nThe resolution would terminate the national emergency declared by the President on February 15, 2019, and undermine the Administration's ability to respond effectively to the ongoing crisis at the Southern Border. The President's emergency declaration, and his further determination that the emergency requires the use of the Armed Forces, allowed the President to invoke the construction authority provided in 10 U.S.C. 2808, and made that authority available to the Secretary of Defense, within his discretion, to undertake military construction projects that are necessary to support such use of the Armed Forces. This is the same authority that President George W. Bush and President Barack Obama used to undertake more than 18 different military construction projects between 2001 and 2013.\nIf H.J. Res. 46 were presented to the President in its current form, his advisors would recommend that he veto it.\n \n\n \n Donald J. Trump, Statement of Administration Policy: H.J. Res. 46 - Terminating the National Emergency Declared by the President on the Southern Border Online by Gerhard Peters and John T. Woolley, The American Presidency Project https://www.presidency.ucsb.edu/node/335315 \n \n \n \n \n Filed Under \nCategoriesOMB: Office of Management and BudgetStatements of Administration Policy\n \n \n \n \n \n \n \n \n \n \n \n \ntwitterfacebooklinkedingoogle+email\n \n Simple Search of Our Archives\n \n \n \n \n \n\n \n \n \n \n \n \n \n \n \n \n\n \n # per page\n5102550100 \n \n \n\n \n Apply\n \n \n \n \n \n\n\n\n \n \n \n \n \n \n \n Report a Typo \n \n \n \n \n \n \n \n \n \n \n\n\n\n\n\n\n\n \n \n \n \n\n\n \n The American Presidency ProjectJohn Woolley and Gerhard PetersContact\n\nTwitter Facebook\n\nCopyright © The American Presidency ProjectTerms of Service | Privacy | Accessibility\n\n \n window.NREUM||(NREUM={});NREUM.info={\"beacon\":\"bam-cell.nr-data.net\",\"licenseKey\":\"dee899de70\",\"applicationID\":\"80106271\",\"transactionName\":\"bl1XYxNYWkVYVxFdWVcXdFQVUFtYFlAWa1NBTEdWEmZaWV1ROkRXXl1qQQhcQw==\",\"queueTime\":0,\"applicationTime\":611,\"atts\":\"QhpUFVtCSUs=\",\"errorBeacon\":\"bam-cell.nr-data.net\",\"agent\":\"\"}"
## [31] "\n Skip to main content\n "
## [32] "Skip to main content"
## [33] " \n\n \n \n \n The American Presidency Project\n\nAbout Search\n\n\n\n \n \n \n \n \n \n\n \n \n Toggle navigation\n \n \n \n \n \n\n \n Documents Guidebook\nCategory Attributes\n\nStatistics\nMedia Archive\nPresidents\nAnalyses\nGIVE\n\n \n \n\n \n \n\n \n \n\n \n Documents\n \n \n Archive Guidebook\nCategories\nAttributes\n\n\nCategories\n \n \n Presidential (227224) Correspondents' Association (32)\nEulogies (62)\nExecutive Orders (6303)\nFireside Chats (27)\nInterviews (958)\nLetters (4626)\nMiscellaneous Remarks (15435)\nMiscellaneous Written (842)\nNews Conferences (2481)\nSigning Statements (2145)\nSpoken Addresses and Remarks (18603)\nFarewell Address (11)\nInaugural Addresses (62)\nMemoranda (3123)\nMessages (11339)\nOral Address (631)\nProclamations (8720)\nSaturday Weekly Addresses (Radio and Webcast) (1639)\nState Dinners (953)\nState of the Union Addresses (98)\nState of the Union Messages (140)\nStatements (13673)\nVetoes (1201)\nWritten Messages (23777)\nWritten Presidential Orders (33338)\n\nPress/Media (17648) Press Briefings (6698)\n\nElections and Transitions (24542) Campaign Documents (4518)\nConvention Speeches (81)\nDebates (171)\nParty Platforms (103)\nTransition Documents (552)\n\nMiscellaneous (430) Opposition Party Responses (33)\nPost Presidential Remarks (10)\n\nCongressional (38)\n\n\n\n \n \n \n \n \n \n \n \n \n \n\n \n \n \n \n\n \n Donald J. Trump \n\n \n \n \n 45th President of the United States: 2017 - 2021\n \n \n\n \n Statement of Administration Policy: H.J. Res. 46 - Terminating the National Emergency Declared by the President on the Southern Border\n \n\n\n \n\n \n February 26, 2019 \n\n \n STATEMENT OF ADMINISTRATION POLICY\n(House)(Rep. Castro, D-TX, and 233 cosponsors)\nThe Administration strongly opposes H.J. Res. 46. The current situation at the Southern Border presents a humanitarian and security crisis that threatens core national security interests and constitutes a national emergency. The Southern Border is a major entry point for criminals, gang members, and illicit narcotics. The problem of large-scale unlawful migration through the Southern Border is enduring, and, despite the Administration's use of existing statutory authorities, in recent years the situation has worsened in certain respects. In particular, we have recently seen sharp increases in the number of illegal entrances into the United States of family units, unaccompanied minors, and persons claiming a fear of return—aliens whom the Administration is largely unable to detain or remove because of antiquated laws and problematic court decisions.\nThe resolution would terminate the national emergency declared by the President on February 15, 2019, and undermine the Administration's ability to respond effectively to the ongoing crisis at the Southern Border. The President's emergency declaration, and his further determination that the emergency requires the use of the Armed Forces, allowed the President to invoke the construction authority provided in 10 U.S.C. 2808, and made that authority available to the Secretary of Defense, within his discretion, to undertake military construction projects that are necessary to support such use of the Armed Forces. This is the same authority that President George W. Bush and President Barack Obama used to undertake more than 18 different military construction projects between 2001 and 2013.\nIf H.J. Res. 46 were presented to the President in its current form, his advisors would recommend that he veto it.\n \n\n \n Donald J. Trump, Statement of Administration Policy: H.J. Res. 46 - Terminating the National Emergency Declared by the President on the Southern Border Online by Gerhard Peters and John T. Woolley, The American Presidency Project https://www.presidency.ucsb.edu/node/335315 \n \n \n \n \n Filed Under \nCategoriesOMB: Office of Management and BudgetStatements of Administration Policy\n \n \n \n \n \n \n \n \n \n \n \n \ntwitterfacebooklinkedingoogle+email\n \n Simple Search of Our Archives\n \n \n \n \n \n\n \n \n \n \n \n \n \n \n \n \n\n \n # per page\n5102550100 \n \n \n\n \n Apply\n \n \n \n \n \n\n\n\n \n \n \n \n \n \n \n Report a Typo \n \n \n \n \n \n \n \n \n \n \n\n\n\n\n\n\n\n \n \n \n \n"
## [34] "\n \n \n The American Presidency Project\n\nAbout Search\n\n\n\n \n "
## [35] "\n \n The American Presidency Project\n\nAbout Search\n\n\n\n "
## [36] "\n The American Presidency Project\n\nAbout Search\n\n\n"
## [37] "The American Presidency Project\n\n"
## [38] "The American Presidency Project"
## [39] "The American Presidency Project"
## [40] "About Search\n\n\n"
## [41] "About Search"
## [42] "About"
## [43] " Search"
## [44] ""
## [45] ""
## [46] ""
## [47] ""
## [48] "\n \n \n\n \n \n Toggle navigation\n \n \n \n \n \n\n \n Documents Guidebook\nCategory Attributes\n\nStatistics\nMedia Archive\nPresidents\nAnalyses\nGIVE\n\n \n "
## [49] "\n \n\n \n \n Toggle navigation\n \n \n \n \n \n\n \n Documents Guidebook\nCategory Attributes\n\nStatistics\nMedia Archive\nPresidents\nAnalyses\nGIVE\n\n "
## [50] "\n\n \n \n Toggle navigation\n \n \n \n \n "
## [51] "\n Toggle navigation\n \n \n \n "
## [52] "Toggle navigation"
## [53] ""
## [54] ""
## [55] ""
## [56] "\n Documents Guidebook\nCategory Attributes\n\nStatistics\nMedia Archive\nPresidents\nAnalyses\nGIVE\n"
## [57] "Documents Guidebook\nCategory Attributes\n\nStatistics\nMedia Archive\nPresidents\nAnalyses\nGIVE\n"
## [58] "Documents Guidebook\nCategory Attributes\n\nStatistics\nMedia Archive\nPresidents\nAnalyses\nGIVE\n"
## [59] "Documents Guidebook\nCategory Attributes\n"
## [60] "Documents "
## [61] ""
## [62] "Guidebook\nCategory Attributes\n"
## [63] "Guidebook"
## [64] "Guidebook"
## [65] "Category Attributes"
## [66] "Category Attributes"
## [67] "Statistics"
## [68] "Statistics"
## [69] "Media Archive"
## [70] "Media Archive"
## [71] "Presidents"
## [72] "Presidents"
## [73] "Analyses"
## [74] "Analyses"
## [75] "GIVE"
## [76] "GIVE"
## [77] "\n "
## [78] "\n \n\n \n Documents\n \n \n Archive Guidebook\nCategories\nAttributes\n\n\nCategories\n \n \n Presidential (227224) Correspondents' Association (32)\nEulogies (62)\nExecutive Orders (6303)\nFireside Chats (27)\nInterviews (958)\nLetters (4626)\nMiscellaneous Remarks (15435)\nMiscellaneous Written (842)\nNews Conferences (2481)\nSigning Statements (2145)\nSpoken Addresses and Remarks (18603)\nFarewell Address (11)\nInaugural Addresses (62)\nMemoranda (3123)\nMessages (11339)\nOral Address (631)\nProclamations (8720)\nSaturday Weekly Addresses (Radio and Webcast) (1639)\nState Dinners (953)\nState of the Union Addresses (98)\nState of the Union Messages (140)\nStatements (13673)\nVetoes (1201)\nWritten Messages (23777)\nWritten Presidential Orders (33338)\n\nPress/Media (17648) Press Briefings (6698)\n\nElections and Transitions (24542) Campaign Documents (4518)\nConvention Speeches (81)\nDebates (171)\nParty Platforms (103)\nTransition Documents (552)\n\nMiscellaneous (430) Opposition Party Responses (33)\nPost Presidential Remarks (10)\n\nCongressional (38)\n\n\n\n \n \n \n \n \n \n \n \n \n \n\n \n \n \n \n\n \n Donald J. Trump \n\n \n \n \n 45th President of the United States: 2017 - 2021\n \n \n\n \n Statement of Administration Policy: H.J. Res. 46 - Terminating the National Emergency Declared by the President on the Southern Border\n \n\n\n \n\n \n February 26, 2019 \n\n \n STATEMENT OF ADMINISTRATION POLICY\n(House)(Rep. Castro, D-TX, and 233 cosponsors)\nThe Administration strongly opposes H.J. Res. 46. The current situation at the Southern Border presents a humanitarian and security crisis that threatens core national security interests and constitutes a national emergency. The Southern Border is a major entry point for criminals, gang members, and illicit narcotics. The problem of large-scale unlawful migration through the Southern Border is enduring, and, despite the Administration's use of existing statutory authorities, in recent years the situation has worsened in certain respects. In particular, we have recently seen sharp increases in the number of illegal entrances into the United States of family units, unaccompanied minors, and persons claiming a fear of return—aliens whom the Administration is largely unable to detain or remove because of antiquated laws and problematic court decisions.\nThe resolution would terminate the national emergency declared by the President on February 15, 2019, and undermine the Administration's ability to respond effectively to the ongoing crisis at the Southern Border. The President's emergency declaration, and his further determination that the emergency requires the use of the Armed Forces, allowed the President to invoke the construction authority provided in 10 U.S.C. 2808, and made that authority available to the Secretary of Defense, within his discretion, to undertake military construction projects that are necessary to support such use of the Armed Forces. This is the same authority that President George W. Bush and President Barack Obama used to undertake more than 18 different military construction projects between 2001 and 2013.\nIf H.J. Res. 46 were presented to the President in its current form, his advisors would recommend that he veto it.\n \n\n \n Donald J. Trump, Statement of Administration Policy: H.J. Res. 46 - Terminating the National Emergency Declared by the President on the Southern Border Online by Gerhard Peters and John T. Woolley, The American Presidency Project https://www.presidency.ucsb.edu/node/335315 \n \n \n \n \n Filed Under \nCategoriesOMB: Office of Management and BudgetStatements of Administration Policy\n \n \n \n \n \n \n \n \n \n \n \n \ntwitterfacebooklinkedingoogle+email\n \n Simple Search of Our Archives\n \n \n \n \n \n\n \n \n \n \n \n \n \n \n \n \n\n \n # per page\n5102550100 \n \n \n\n \n Apply\n \n \n \n \n \n\n\n\n \n \n \n \n \n \n \n Report a Typo \n \n \n \n \n \n \n \n \n \n \n\n\n\n\n\n\n\n \n "
## [79] "\n\n \n Documents\n \n \n Archive Guidebook\nCategories\nAttributes\n\n\nCategories\n \n \n Presidential (227224) Correspondents' Association (32)\nEulogies (62)\nExecutive Orders (6303)\nFireside Chats (27)\nInterviews (958)\nLetters (4626)\nMiscellaneous Remarks (15435)\nMiscellaneous Written (842)\nNews Conferences (2481)\nSigning Statements (2145)\nSpoken Addresses and Remarks (18603)\nFarewell Address (11)\nInaugural Addresses (62)\nMemoranda (3123)\nMessages (11339)\nOral Address (631)\nProclamations (8720)\nSaturday Weekly Addresses (Radio and Webcast) (1639)\nState Dinners (953)\nState of the Union Addresses (98)\nState of the Union Messages (140)\nStatements (13673)\nVetoes (1201)\nWritten Messages (23777)\nWritten Presidential Orders (33338)\n\nPress/Media (17648) Press Briefings (6698)\n\nElections and Transitions (24542) Campaign Documents (4518)\nConvention Speeches (81)\nDebates (171)\nParty Platforms (103)\nTransition Documents (552)\n\nMiscellaneous (430) Opposition Party Responses (33)\nPost Presidential Remarks (10)\n\nCongressional (38)\n\n\n\n \n \n \n \n \n \n \n \n \n \n\n \n \n \n \n\n \n Donald J. Trump \n\n \n \n \n 45th President of the United States: 2017 - 2021\n \n \n\n \n Statement of Administration Policy: H.J. Res. 46 - Terminating the National Emergency Declared by the President on the Southern Border\n \n\n\n \n\n \n February 26, 2019 \n\n \n STATEMENT OF ADMINISTRATION POLICY\n(House)(Rep. Castro, D-TX, and 233 cosponsors)\nThe Administration strongly opposes H.J. Res. 46. The current situation at the Southern Border presents a humanitarian and security crisis that threatens core national security interests and constitutes a national emergency. The Southern Border is a major entry point for criminals, gang members, and illicit narcotics. The problem of large-scale unlawful migration through the Southern Border is enduring, and, despite the Administration's use of existing statutory authorities, in recent years the situation has worsened in certain respects. In particular, we have recently seen sharp increases in the number of illegal entrances into the United States of family units, unaccompanied minors, and persons claiming a fear of return—aliens whom the Administration is largely unable to detain or remove because of antiquated laws and problematic court decisions.\nThe resolution would terminate the national emergency declared by the President on February 15, 2019, and undermine the Administration's ability to respond effectively to the ongoing crisis at the Southern Border. The President's emergency declaration, and his further determination that the emergency requires the use of the Armed Forces, allowed the President to invoke the construction authority provided in 10 U.S.C. 2808, and made that authority available to the Secretary of Defense, within his discretion, to undertake military construction projects that are necessary to support such use of the Armed Forces. This is the same authority that President George W. Bush and President Barack Obama used to undertake more than 18 different military construction projects between 2001 and 2013.\nIf H.J. Res. 46 were presented to the President in its current form, his advisors would recommend that he veto it.\n \n\n \n Donald J. Trump, Statement of Administration Policy: H.J. Res. 46 - Terminating the National Emergency Declared by the President on the Southern Border Online by Gerhard Peters and John T. Woolley, The American Presidency Project https://www.presidency.ucsb.edu/node/335315 \n \n \n \n \n Filed Under \nCategoriesOMB: Office of Management and BudgetStatements of Administration Policy\n \n \n \n \n \n \n \n \n \n \n \n \ntwitterfacebooklinkedingoogle+email\n \n Simple Search of Our Archives\n \n \n \n \n \n\n \n \n \n \n \n \n \n \n \n \n\n \n # per page\n5102550100 \n \n \n\n \n Apply\n \n \n \n \n \n\n\n\n \n \n \n \n \n \n \n Report a Typo \n \n \n \n \n \n \n \n \n \n \n\n\n\n\n\n\n\n "
## [80] "\n Documents\n \n \n Archive Guidebook\nCategories\nAttributes\n\n\nCategories\n \n \n Presidential (227224) Correspondents' Association (32)\nEulogies (62)\nExecutive Orders (6303)\nFireside Chats (27)\nInterviews (958)\nLetters (4626)\nMiscellaneous Remarks (15435)\nMiscellaneous Written (842)\nNews Conferences (2481)\nSigning Statements (2145)\nSpoken Addresses and Remarks (18603)\nFarewell Address (11)\nInaugural Addresses (62)\nMemoranda (3123)\nMessages (11339)\nOral Address (631)\nProclamations (8720)\nSaturday Weekly Addresses (Radio and Webcast) (1639)\nState Dinners (953)\nState of the Union Addresses (98)\nState of the Union Messages (140)\nStatements (13673)\nVetoes (1201)\nWritten Messages (23777)\nWritten Presidential Orders (33338)\n\nPress/Media (17648) Press Briefings (6698)\n\nElections and Transitions (24542) Campaign Documents (4518)\nConvention Speeches (81)\nDebates (171)\nParty Platforms (103)\nTransition Documents (552)\n\nMiscellaneous (430) Opposition Party Responses (33)\nPost Presidential Remarks (10)\n\nCongressional (38)\n\n\n\n "
## [81] "\n Documents\n \n \n Archive Guidebook\nCategories\nAttributes\n\n\nCategories\n \n \n Presidential (227224) Correspondents' Association (32)\nEulogies (62)\nExecutive Orders (6303)\nFireside Chats (27)\nInterviews (958)\nLetters (4626)\nMiscellaneous Remarks (15435)\nMiscellaneous Written (842)\nNews Conferences (2481)\nSigning Statements (2145)\nSpoken Addresses and Remarks (18603)\nFarewell Address (11)\nInaugural Addresses (62)\nMemoranda (3123)\nMessages (11339)\nOral Address (631)\nProclamations (8720)\nSaturday Weekly Addresses (Radio and Webcast) (1639)\nState Dinners (953)\nState of the Union Addresses (98)\nState of the Union Messages (140)\nStatements (13673)\nVetoes (1201)\nWritten Messages (23777)\nWritten Presidential Orders (33338)\n\nPress/Media (17648) Press Briefings (6698)\n\nElections and Transitions (24542) Campaign Documents (4518)\nConvention Speeches (81)\nDebates (171)\nParty Platforms (103)\nTransition Documents (552)\n\nMiscellaneous (430) Opposition Party Responses (33)\nPost Presidential Remarks (10)\n\nCongressional (38)\n\n\n"
## [82] "Documents\n \n \n Archive Guidebook\nCategories\nAttributes\n\n\n"
## [83] "Documents"
## [84] "\n Archive Guidebook\nCategories\nAttributes\n"
## [85] "Archive Guidebook\nCategories\nAttributes\n"
## [86] "Archive Guidebook"
## [87] "Archive Guidebook"
## [88] "Categories"
## [89] "Categories"
## [90] "Attributes"
## [91] "Attributes"
## [92] "Categories\n \n \n Presidential (227224) Correspondents' Association (32)\nEulogies (62)\nExecutive Orders (6303)\nFireside Chats (27)\nInterviews (958)\nLetters (4626)\nMiscellaneous Remarks (15435)\nMiscellaneous Written (842)\nNews Conferences (2481)\nSigning Statements (2145)\nSpoken Addresses and Remarks (18603)\nFarewell Address (11)\nInaugural Addresses (62)\nMemoranda (3123)\nMessages (11339)\nOral Address (631)\nProclamations (8720)\nSaturday Weekly Addresses (Radio and Webcast) (1639)\nState Dinners (953)\nState of the Union Addresses (98)\nState of the Union Messages (140)\nStatements (13673)\nVetoes (1201)\nWritten Messages (23777)\nWritten Presidential Orders (33338)\n\nPress/Media (17648) Press Briefings (6698)\n\nElections and Transitions (24542) Campaign Documents (4518)\nConvention Speeches (81)\nDebates (171)\nParty Platforms (103)\nTransition Documents (552)\n\nMiscellaneous (430) Opposition Party Responses (33)\nPost Presidential Remarks (10)\n\nCongressional (38)\n\n\n"
## [93] "Categories"
## [94] "\n Presidential (227224) Correspondents' Association (32)\nEulogies (62)\nExecutive Orders (6303)\nFireside Chats (27)\nInterviews (958)\nLetters (4626)\nMiscellaneous Remarks (15435)\nMiscellaneous Written (842)\nNews Conferences (2481)\nSigning Statements (2145)\nSpoken Addresses and Remarks (18603)\nFarewell Address (11)\nInaugural Addresses (62)\nMemoranda (3123)\nMessages (11339)\nOral Address (631)\nProclamations (8720)\nSaturday Weekly Addresses (Radio and Webcast) (1639)\nState Dinners (953)\nState of the Union Addresses (98)\nState of the Union Messages (140)\nStatements (13673)\nVetoes (1201)\nWritten Messages (23777)\nWritten Presidential Orders (33338)\n\nPress/Media (17648) Press Briefings (6698)\n\nElections and Transitions (24542) Campaign Documents (4518)\nConvention Speeches (81)\nDebates (171)\nParty Platforms (103)\nTransition Documents (552)\n\nMiscellaneous (430) Opposition Party Responses (33)\nPost Presidential Remarks (10)\n\nCongressional (38)\n"
## [95] "Presidential (227224) Correspondents' Association (32)\nEulogies (62)\nExecutive Orders (6303)\nFireside Chats (27)\nInterviews (958)\nLetters (4626)\nMiscellaneous Remarks (15435)\nMiscellaneous Written (842)\nNews Conferences (2481)\nSigning Statements (2145)\nSpoken Addresses and Remarks (18603)\nFarewell Address (11)\nInaugural Addresses (62)\nMemoranda (3123)\nMessages (11339)\nOral Address (631)\nProclamations (8720)\nSaturday Weekly Addresses (Radio and Webcast) (1639)\nState Dinners (953)\nState of the Union Addresses (98)\nState of the Union Messages (140)\nStatements (13673)\nVetoes (1201)\nWritten Messages (23777)\nWritten Presidential Orders (33338)\n\nPress/Media (17648) Press Briefings (6698)\n\nElections and Transitions (24542) Campaign Documents (4518)\nConvention Speeches (81)\nDebates (171)\nParty Platforms (103)\nTransition Documents (552)\n\nMiscellaneous (430) Opposition Party Responses (33)\nPost Presidential Remarks (10)\n\nCongressional (38)\n"
## [96] "Presidential (227224) Correspondents' Association (32)\nEulogies (62)\nExecutive Orders (6303)\nFireside Chats (27)\nInterviews (958)\nLetters (4626)\nMiscellaneous Remarks (15435)\nMiscellaneous Written (842)\nNews Conferences (2481)\nSigning Statements (2145)\nSpoken Addresses and Remarks (18603)\nFarewell Address (11)\nInaugural Addresses (62)\nMemoranda (3123)\nMessages (11339)\nOral Address (631)\nProclamations (8720)\nSaturday Weekly Addresses (Radio and Webcast) (1639)\nState Dinners (953)\nState of the Union Addresses (98)\nState of the Union Messages (140)\nStatements (13673)\nVetoes (1201)\nWritten Messages (23777)\nWritten Presidential Orders (33338)\n"
## [97] "Presidential (227224) "
## [98] ""
## [99] "Correspondents' Association (32)\nEulogies (62)\nExecutive Orders (6303)\nFireside Chats (27)\nInterviews (958)\nLetters (4626)\nMiscellaneous Remarks (15435)\nMiscellaneous Written (842)\nNews Conferences (2481)\nSigning Statements (2145)\nSpoken Addresses and Remarks (18603)\nFarewell Address (11)\nInaugural Addresses (62)\nMemoranda (3123)\nMessages (11339)\nOral Address (631)\nProclamations (8720)\nSaturday Weekly Addresses (Radio and Webcast) (1639)\nState Dinners (953)\nState of the Union Addresses (98)\nState of the Union Messages (140)\nStatements (13673)\nVetoes (1201)\nWritten Messages (23777)\nWritten Presidential Orders (33338)\n"
## [100] "Correspondents' Association (32)"
## [101] "Correspondents' Association (32)"
## [102] "Eulogies (62)"
## [103] "Eulogies (62)"
## [104] "Executive Orders (6303)"
## [105] "Executive Orders (6303)"
## [106] "Fireside Chats (27)"
## [107] "Fireside Chats (27)"
## [108] "Interviews (958)"
## [109] "Interviews (958)"
## [110] "Letters (4626)"
## [111] "Letters (4626)"
## [112] "Miscellaneous Remarks (15435)"
## [113] "Miscellaneous Remarks (15435)"
## [114] "Miscellaneous Written (842)"
## [115] "Miscellaneous Written (842)"
## [116] "News Conferences (2481)"
## [117] "News Conferences (2481)"
## [118] "Signing Statements (2145)"
## [119] "Signing Statements (2145)"
## [120] "Spoken Addresses and Remarks (18603)"
## [121] "Spoken Addresses and Remarks (18603)"
## [122] "Farewell Address (11)"
## [123] "Farewell Address (11)"
## [124] "Inaugural Addresses (62)"
## [125] "Inaugural Addresses (62)"
## [126] "Memoranda (3123)"
## [127] "Memoranda (3123)"
## [128] "Messages (11339)"
## [129] "Messages (11339)"
## [130] "Oral Address (631)"
## [131] "Oral Address (631)"
## [132] "Proclamations (8720)"
## [133] "Proclamations (8720)"
## [134] "Saturday Weekly Addresses (Radio and Webcast) (1639)"
## [135] "Saturday Weekly Addresses (Radio and Webcast) (1639)"
## [136] "State Dinners (953)"
## [137] "State Dinners (953)"
## [138] "State of the Union Addresses (98)"
## [139] "State of the Union Addresses (98)"
## [140] "State of the Union Messages (140)"
## [141] "State of the Union Messages (140)"
## [142] "Statements (13673)"
## [143] "Statements (13673)"
## [144] "Vetoes (1201)"
## [145] "Vetoes (1201)"
## [146] "Written Messages (23777)"
## [147] "Written Messages (23777)"
## [148] "Written Presidential Orders (33338)"
## [149] "Written Presidential Orders (33338)"
## [150] "Press/Media (17648) Press Briefings (6698)\n"
## [151] "Press/Media (17648) "
## [152] ""
## [153] "Press Briefings (6698)\n"
## [154] "Press Briefings (6698)"
## [155] "Press Briefings (6698)"
## [156] "Elections and Transitions (24542) Campaign Documents (4518)\nConvention Speeches (81)\nDebates (171)\nParty Platforms (103)\nTransition Documents (552)\n"
## [157] "Elections and Transitions (24542) "
## [158] ""
## [159] "Campaign Documents (4518)\nConvention Speeches (81)\nDebates (171)\nParty Platforms (103)\nTransition Documents (552)\n"
## [160] "Campaign Documents (4518)"
## [161] "Campaign Documents (4518)"
## [162] "Convention Speeches (81)"
## [163] "Convention Speeches (81)"
## [164] "Debates (171)"
## [165] "Debates (171)"
## [166] "Party Platforms (103)"
## [167] "Party Platforms (103)"
## [168] "Transition Documents (552)"
## [169] "Transition Documents (552)"
## [170] "Miscellaneous (430) Opposition Party Responses (33)\nPost Presidential Remarks (10)\n"
## [171] "Miscellaneous (430) "
## [172] ""
## [173] "Opposition Party Responses (33)\nPost Presidential Remarks (10)\n"
## [174] "Opposition Party Responses (33)"
## [175] "Opposition Party Responses (33)"
## [176] "Post Presidential Remarks (10)"
## [177] "Post Presidential Remarks (10)"
## [178] "Congressional (38)"
## [179] "Congressional (38)"
## [180] "\n \n \n \n \n \n \n \n \n \n\n \n \n \n \n\n \n Donald J. Trump \n\n \n \n \n 45th President of the United States: 2017 - 2021\n \n \n\n \n Statement of Administration Policy: H.J. Res. 46 - Terminating the National Emergency Declared by the President on the Southern Border\n \n\n\n \n\n \n February 26, 2019 \n\n \n STATEMENT OF ADMINISTRATION POLICY\n(House)(Rep. Castro, D-TX, and 233 cosponsors)\nThe Administration strongly opposes H.J. Res. 46. The current situation at the Southern Border presents a humanitarian and security crisis that threatens core national security interests and constitutes a national emergency. The Southern Border is a major entry point for criminals, gang members, and illicit narcotics. The problem of large-scale unlawful migration through the Southern Border is enduring, and, despite the Administration's use of existing statutory authorities, in recent years the situation has worsened in certain respects. In particular, we have recently seen sharp increases in the number of illegal entrances into the United States of family units, unaccompanied minors, and persons claiming a fear of return—aliens whom the Administration is largely unable to detain or remove because of antiquated laws and problematic court decisions.\nThe resolution would terminate the national emergency declared by the President on February 15, 2019, and undermine the Administration's ability to respond effectively to the ongoing crisis at the Southern Border. The President's emergency declaration, and his further determination that the emergency requires the use of the Armed Forces, allowed the President to invoke the construction authority provided in 10 U.S.C. 2808, and made that authority available to the Secretary of Defense, within his discretion, to undertake military construction projects that are necessary to support such use of the Armed Forces. This is the same authority that President George W. Bush and President Barack Obama used to undertake more than 18 different military construction projects between 2001 and 2013.\nIf H.J. Res. 46 were presented to the President in its current form, his advisors would recommend that he veto it.\n \n\n \n Donald J. Trump, Statement of Administration Policy: H.J. Res. 46 - Terminating the National Emergency Declared by the President on the Southern Border Online by Gerhard Peters and John T. Woolley, The American Presidency Project https://www.presidency.ucsb.edu/node/335315 \n \n \n \n \n Filed Under \nCategoriesOMB: Office of Management and BudgetStatements of Administration Policy\n \n \n \n \n \n \n \n \n \n \n \n \ntwitterfacebooklinkedingoogle+email\n \n Simple Search of Our Archives\n \n \n \n \n \n\n \n \n \n \n \n \n \n \n \n \n\n \n # per page\n5102550100 \n \n \n\n \n Apply\n \n \n \n \n \n\n\n\n \n \n \n \n \n \n \n Report a Typo \n \n \n \n \n \n \n \n \n \n \n\n\n\n\n\n\n\n "
## [181] ""
## [182] "\n \n \n \n \n \n \n\n \n \n \n \n\n \n Donald J. Trump \n\n \n \n \n 45th President of the United States: 2017 - 2021\n \n \n\n \n Statement of Administration Policy: H.J. Res. 46 - Terminating the National Emergency Declared by the President on the Southern Border\n \n\n\n \n\n \n February 26, 2019 \n\n \n STATEMENT OF ADMINISTRATION POLICY\n(House)(Rep. Castro, D-TX, and 233 cosponsors)\nThe Administration strongly opposes H.J. Res. 46. The current situation at the Southern Border presents a humanitarian and security crisis that threatens core national security interests and constitutes a national emergency. The Southern Border is a major entry point for criminals, gang members, and illicit narcotics. The problem of large-scale unlawful migration through the Southern Border is enduring, and, despite the Administration's use of existing statutory authorities, in recent years the situation has worsened in certain respects. In particular, we have recently seen sharp increases in the number of illegal entrances into the United States of family units, unaccompanied minors, and persons claiming a fear of return—aliens whom the Administration is largely unable to detain or remove because of antiquated laws and problematic court decisions.\nThe resolution would terminate the national emergency declared by the President on February 15, 2019, and undermine the Administration's ability to respond effectively to the ongoing crisis at the Southern Border. The President's emergency declaration, and his further determination that the emergency requires the use of the Armed Forces, allowed the President to invoke the construction authority provided in 10 U.S.C. 2808, and made that authority available to the Secretary of Defense, within his discretion, to undertake military construction projects that are necessary to support such use of the Armed Forces. This is the same authority that President George W. Bush and President Barack Obama used to undertake more than 18 different military construction projects between 2001 and 2013.\nIf H.J. Res. 46 were presented to the President in its current form, his advisors would recommend that he veto it.\n \n\n \n Donald J. Trump, Statement of Administration Policy: H.J. Res. 46 - Terminating the National Emergency Declared by the President on the Southern Border Online by Gerhard Peters and John T. Woolley, The American Presidency Project https://www.presidency.ucsb.edu/node/335315 \n \n \n \n \n Filed Under \nCategoriesOMB: Office of Management and BudgetStatements of Administration Policy\n \n \n \n \n \n \n \n \n \n \n \n \ntwitterfacebooklinkedingoogle+email\n \n Simple Search of Our Archives\n \n \n \n \n \n\n \n \n \n \n \n \n \n \n \n \n\n \n # per page\n5102550100 \n \n \n\n \n Apply\n \n \n \n \n \n\n\n\n \n \n \n \n \n \n \n Report a Typo \n \n \n \n \n \n \n \n \n \n \n\n\n\n\n\n"
## [183] "\n \n \n \n \n \n\n \n \n \n \n\n \n Donald J. Trump \n\n \n \n \n 45th President of the United States: 2017 - 2021\n \n \n\n \n Statement of Administration Policy: H.J. Res. 46 - Terminating the National Emergency Declared by the President on the Southern Border\n \n\n\n \n\n \n February 26, 2019 \n\n \n STATEMENT OF ADMINISTRATION POLICY\n(House)(Rep. Castro, D-TX, and 233 cosponsors)\nThe Administration strongly opposes H.J. Res. 46. The current situation at the Southern Border presents a humanitarian and security crisis that threatens core national security interests and constitutes a national emergency. The Southern Border is a major entry point for criminals, gang members, and illicit narcotics. The problem of large-scale unlawful migration through the Southern Border is enduring, and, despite the Administration's use of existing statutory authorities, in recent years the situation has worsened in certain respects. In particular, we have recently seen sharp increases in the number of illegal entrances into the United States of family units, unaccompanied minors, and persons claiming a fear of return—aliens whom the Administration is largely unable to detain or remove because of antiquated laws and problematic court decisions.\nThe resolution would terminate the national emergency declared by the President on February 15, 2019, and undermine the Administration's ability to respond effectively to the ongoing crisis at the Southern Border. The President's emergency declaration, and his further determination that the emergency requires the use of the Armed Forces, allowed the President to invoke the construction authority provided in 10 U.S.C. 2808, and made that authority available to the Secretary of Defense, within his discretion, to undertake military construction projects that are necessary to support such use of the Armed Forces. This is the same authority that President George W. Bush and President Barack Obama used to undertake more than 18 different military construction projects between 2001 and 2013.\nIf H.J. Res. 46 were presented to the President in its current form, his advisors would recommend that he veto it.\n \n\n \n Donald J. Trump, Statement of Administration Policy: H.J. Res. 46 - Terminating the National Emergency Declared by the President on the Southern Border Online by Gerhard Peters and John T. Woolley, The American Presidency Project https://www.presidency.ucsb.edu/node/335315 \n \n \n \n \n Filed Under \nCategoriesOMB: Office of Management and BudgetStatements of Administration Policy\n \n \n \n \n \n \n \n \n \n \n \n \ntwitterfacebooklinkedingoogle+email\n \n Simple Search of Our Archives\n \n \n \n \n \n\n \n \n \n \n \n \n \n \n \n \n\n \n # per page\n5102550100 \n \n \n\n \n Apply\n \n \n \n \n \n\n\n\n \n \n \n \n \n \n \n Report a Typo \n \n \n \n \n \n \n \n \n \n \n\n\n\n\n\n"
## [184] "\n \n \n \n \n \n\n \n \n \n \n\n \n Donald J. Trump \n\n \n \n \n 45th President of the United States: 2017 - 2021\n \n \n\n \n Statement of Administration Policy: H.J. Res. 46 - Terminating the National Emergency Declared by the President on the Southern Border\n \n\n\n \n\n \n February 26, 2019 \n\n \n STATEMENT OF ADMINISTRATION POLICY\n(House)(Rep. Castro, D-TX, and 233 cosponsors)\nThe Administration strongly opposes H.J. Res. 46. The current situation at the Southern Border presents a humanitarian and security crisis that threatens core national security interests and constitutes a national emergency. The Southern Border is a major entry point for criminals, gang members, and illicit narcotics. The problem of large-scale unlawful migration through the Southern Border is enduring, and, despite the Administration's use of existing statutory authorities, in recent years the situation has worsened in certain respects. In particular, we have recently seen sharp increases in the number of illegal entrances into the United States of family units, unaccompanied minors, and persons claiming a fear of return—aliens whom the Administration is largely unable to detain or remove because of antiquated laws and problematic court decisions.\nThe resolution would terminate the national emergency declared by the President on February 15, 2019, and undermine the Administration's ability to respond effectively to the ongoing crisis at the Southern Border. The President's emergency declaration, and his further determination that the emergency requires the use of the Armed Forces, allowed the President to invoke the construction authority provided in 10 U.S.C. 2808, and made that authority available to the Secretary of Defense, within his discretion, to undertake military construction projects that are necessary to support such use of the Armed Forces. This is the same authority that President George W. Bush and President Barack Obama used to undertake more than 18 different military construction projects between 2001 and 2013.\nIf H.J. Res. 46 were presented to the President in its current form, his advisors would recommend that he veto it.\n \n\n \n Donald J. Trump, Statement of Administration Policy: H.J. Res. 46 - Terminating the National Emergency Declared by the President on the Southern Border Online by Gerhard Peters and John T. Woolley, The American Presidency Project https://www.presidency.ucsb.edu/node/335315 \n \n \n \n \n Filed Under \nCategoriesOMB: Office of Management and BudgetStatements of Administration Policy\n \n \n \n \n \n \n \n \n \n \n \n \ntwitterfacebooklinkedingoogle+email\n \n Simple Search of Our Archives\n \n \n \n \n \n\n \n \n \n \n \n \n \n \n \n \n\n \n # per page\n5102550100 \n \n \n\n \n Apply\n \n \n \n \n \n\n\n\n \n \n \n \n \n \n \n Report a Typo \n \n \n \n \n \n \n \n \n \n \n"
## [185] "\n \n \n \n \n\n \n \n \n \n\n \n Donald J. Trump \n\n \n \n \n 45th President of the United States: 2017 - 2021\n \n \n\n \n Statement of Administration Policy: H.J. Res. 46 - Terminating the National Emergency Declared by the President on the Southern Border\n \n\n\n \n\n \n February 26, 2019 \n\n \n STATEMENT OF ADMINISTRATION POLICY\n(House)(Rep. Castro, D-TX, and 233 cosponsors)\nThe Administration strongly opposes H.J. Res. 46. The current situation at the Southern Border presents a humanitarian and security crisis that threatens core national security interests and constitutes a national emergency. The Southern Border is a major entry point for criminals, gang members, and illicit narcotics. The problem of large-scale unlawful migration through the Southern Border is enduring, and, despite the Administration's use of existing statutory authorities, in recent years the situation has worsened in certain respects. In particular, we have recently seen sharp increases in the number of illegal entrances into the United States of family units, unaccompanied minors, and persons claiming a fear of return—aliens whom the Administration is largely unable to detain or remove because of antiquated laws and problematic court decisions.\nThe resolution would terminate the national emergency declared by the President on February 15, 2019, and undermine the Administration's ability to respond effectively to the ongoing crisis at the Southern Border. The President's emergency declaration, and his further determination that the emergency requires the use of the Armed Forces, allowed the President to invoke the construction authority provided in 10 U.S.C. 2808, and made that authority available to the Secretary of Defense, within his discretion, to undertake military construction projects that are necessary to support such use of the Armed Forces. This is the same authority that President George W. Bush and President Barack Obama used to undertake more than 18 different military construction projects between 2001 and 2013.\nIf H.J. Res. 46 were presented to the President in its current form, his advisors would recommend that he veto it.\n \n\n \n Donald J. Trump, Statement of Administration Policy: H.J. Res. 46 - Terminating the National Emergency Declared by the President on the Southern Border Online by Gerhard Peters and John T. Woolley, The American Presidency Project https://www.presidency.ucsb.edu/node/335315 \n \n \n \n \n Filed Under \nCategoriesOMB: Office of Management and BudgetStatements of Administration Policy\n \n \n \n \n \n \n \n \n \n \n \n \ntwitterfacebooklinkedingoogle+email\n \n Simple Search of Our Archives\n \n \n \n \n \n\n \n \n \n \n \n \n \n \n \n \n\n \n # per page\n5102550100 \n \n \n\n \n Apply\n \n \n \n \n \n\n\n\n \n \n \n \n \n \n \n Report a Typo \n \n \n \n \n \n \n \n \n \n "
## [186] "\n \n \n \n\n \n \n \n \n\n \n Donald J. Trump \n\n \n \n \n 45th President of the United States: 2017 - 2021\n \n \n\n \n Statement of Administration Policy: H.J. Res. 46 - Terminating the National Emergency Declared by the President on the Southern Border\n \n\n\n \n\n \n February 26, 2019 \n\n \n STATEMENT OF ADMINISTRATION POLICY\n(House)(Rep. Castro, D-TX, and 233 cosponsors)\nThe Administration strongly opposes H.J. Res. 46. The current situation at the Southern Border presents a humanitarian and security crisis that threatens core national security interests and constitutes a national emergency. The Southern Border is a major entry point for criminals, gang members, and illicit narcotics. The problem of large-scale unlawful migration through the Southern Border is enduring, and, despite the Administration's use of existing statutory authorities, in recent years the situation has worsened in certain respects. In particular, we have recently seen sharp increases in the number of illegal entrances into the United States of family units, unaccompanied minors, and persons claiming a fear of return—aliens whom the Administration is largely unable to detain or remove because of antiquated laws and problematic court decisions.\nThe resolution would terminate the national emergency declared by the President on February 15, 2019, and undermine the Administration's ability to respond effectively to the ongoing crisis at the Southern Border. The President's emergency declaration, and his further determination that the emergency requires the use of the Armed Forces, allowed the President to invoke the construction authority provided in 10 U.S.C. 2808, and made that authority available to the Secretary of Defense, within his discretion, to undertake military construction projects that are necessary to support such use of the Armed Forces. This is the same authority that President George W. Bush and President Barack Obama used to undertake more than 18 different military construction projects between 2001 and 2013.\nIf H.J. Res. 46 were presented to the President in its current form, his advisors would recommend that he veto it.\n \n\n \n Donald J. Trump, Statement of Administration Policy: H.J. Res. 46 - Terminating the National Emergency Declared by the President on the Southern Border Online by Gerhard Peters and John T. Woolley, The American Presidency Project https://www.presidency.ucsb.edu/node/335315 \n "
## [187] "\n \n\n \n \n \n \n\n \n Donald J. Trump \n\n \n \n \n 45th President of the United States: 2017 - 2021\n \n \n\n \n Statement of Administration Policy: H.J. Res. 46 - Terminating the National Emergency Declared by the President on the Southern Border\n \n\n\n "
## [188] "\n\n \n \n \n \n\n \n Donald J. Trump \n\n \n \n \n 45th President of the United States: 2017 - 2021\n \n \n\n \n Statement of Administration Policy: H.J. Res. 46 - Terminating the National Emergency Declared by the President on the Southern Border\n \n"
## [189] "\n "
## [190] ""
## [191] "\n Donald J. Trump "
## [192] "Donald J. Trump"
## [193] "Donald J. Trump"
## [194] "\n \n \n 45th President of the United States: 2017 - 2021\n \n "
## [195] "\n 45th President of the United States: 2017 - 2021\n "
## [196] "45th President of the United States: 2017 - 2021"
## [197] "45th"
## [198] "President of the United States:"
## [199] "2017 - 2021"
## [200] "\n Statement of Administration Policy: H.J. Res. 46 - Terminating the National Emergency Declared by the President on the Southern Border\n "
## [201] "Statement of Administration Policy: H.J. Res. 46 - Terminating the National Emergency Declared by the President on the Southern Border"
## [202] "\n February 26, 2019 "
## [203] "February 26, 2019"
## [204] "\n STATEMENT OF ADMINISTRATION POLICY\n(House)(Rep. Castro, D-TX, and 233 cosponsors)\nThe Administration strongly opposes H.J. Res. 46. The current situation at the Southern Border presents a humanitarian and security crisis that threatens core national security interests and constitutes a national emergency. The Southern Border is a major entry point for criminals, gang members, and illicit narcotics. The problem of large-scale unlawful migration through the Southern Border is enduring, and, despite the Administration's use of existing statutory authorities, in recent years the situation has worsened in certain respects. In particular, we have recently seen sharp increases in the number of illegal entrances into the United States of family units, unaccompanied minors, and persons claiming a fear of return—aliens whom the Administration is largely unable to detain or remove because of antiquated laws and problematic court decisions.\nThe resolution would terminate the national emergency declared by the President on February 15, 2019, and undermine the Administration's ability to respond effectively to the ongoing crisis at the Southern Border. The President's emergency declaration, and his further determination that the emergency requires the use of the Armed Forces, allowed the President to invoke the construction authority provided in 10 U.S.C. 2808, and made that authority available to the Secretary of Defense, within his discretion, to undertake military construction projects that are necessary to support such use of the Armed Forces. This is the same authority that President George W. Bush and President Barack Obama used to undertake more than 18 different military construction projects between 2001 and 2013.\nIf H.J. Res. 46 were presented to the President in its current form, his advisors would recommend that he veto it.\n "
## [205] ""
## [206] "STATEMENT OF ADMINISTRATION POLICY"
## [207] "STATEMENT OF ADMINISTRATION POLICY"
## [208] "(House)(Rep. Castro, D-TX, and 233 cosponsors)\n"
## [209] "(House)(Rep. Castro, D-TX, and 233 cosponsors)"
## [210] ""
## [211] "The Administration strongly opposes H.J. Res. 46. The current situation at the Southern Border presents a humanitarian and security crisis that threatens core national security interests and constitutes a national emergency. The Southern Border is a major entry point for criminals, gang members, and illicit narcotics. The problem of large-scale unlawful migration through the Southern Border is enduring, and, despite the Administration's use of existing statutory authorities, in recent years the situation has worsened in certain respects. In particular, we have recently seen sharp increases in the number of illegal entrances into the United States of family units, unaccompanied minors, and persons claiming a fear of return—aliens whom the Administration is largely unable to detain or remove because of antiquated laws and problematic court decisions.\n"
## [212] "The resolution would terminate the national emergency declared by the President on February 15, 2019, and undermine the Administration's ability to respond effectively to the ongoing crisis at the Southern Border. The President's emergency declaration, and his further determination that the emergency requires the use of the Armed Forces, allowed the President to invoke the construction authority provided in 10 U.S.C. 2808, and made that authority available to the Secretary of Defense, within his discretion, to undertake military construction projects that are necessary to support such use of the Armed Forces. This is the same authority that President George W. Bush and President Barack Obama used to undertake more than 18 different military construction projects between 2001 and 2013.\n"
## [213] "If H.J. Res. 46 were presented to the President in its current form, his advisors would recommend that he veto it."
## [214] "If H.J. Res. 46 were presented to the President in its current form, his advisors would recommend that he veto it"
## [215] "\n Donald J. Trump, Statement of Administration Policy: H.J. Res. 46 - Terminating the National Emergency Declared by the President on the Southern Border Online by Gerhard Peters and John T. Woolley, The American Presidency Project https://www.presidency.ucsb.edu/node/335315 "
## [216] "Donald J. Trump, Statement of Administration Policy: H.J. Res. 46 - Terminating the National Emergency Declared by the President on the Southern Border Online by Gerhard Peters and John T. Woolley, The American Presidency Project https://www.presidency.ucsb.edu/node/335315"
## [217] "\n \n \n Filed Under \nCategoriesOMB: Office of Management and BudgetStatements of Administration Policy\n \n \n \n \n \n \n \n \n \n \n \n \ntwitterfacebooklinkedingoogle+email\n \n Simple Search of Our Archives\n \n \n \n \n \n\n \n \n \n \n \n \n \n \n \n \n\n \n # per page\n5102550100 \n \n \n\n \n Apply\n \n \n \n \n \n\n\n\n \n \n \n \n \n \n \n Report a Typo \n \n \n \n \n \n \n \n \n "
## [218] "\n \n Filed Under \nCategoriesOMB: Office of Management and BudgetStatements of Administration Policy\n \n \n \n \n \n \n \n \n \n \n \n \n"
## [219] "\n Filed Under "
## [220] "Filed Under"
## [221] "Categories"
## [222] "OMB: Office of Management and Budget"
## [223] "OMB: Office of Management and Budget"
## [224] "Statements of Administration Policy"
## [225] "Statements of Administration Policy"
## [226] "\n \n \n \n \n \n \n \n \n \n \n \n \n"
## [227] "\n \n \n \n \n \n \n \n \n \n \n \n \n"
## [228] "\n \n \n "
## [229] "\n "
## [230] "twitterfacebooklinkedingoogle+email"
## [231] "twitterfacebooklinkedingoogle+email"
## [232] "twitter"
## [233] "twitter"
## [234] ""
## [235] "twitter"
## [236] "facebook"
## [237] "facebook"
## [238] ""
## [239] "facebook"
## [240] "linkedin"
## [241] "linkedin"
## [242] ""
## [243] "linkedin"
## [244] "google+"
## [245] "google+"
## [246] ""
## [247] "google+"
## [248] "email"
## [249] "email"
## [250] ""
## [251] "email"
## [252] "\n Simple Search of Our Archives\n \n \n \n \n \n\n \n \n \n \n \n \n \n \n \n \n\n \n # per page\n5102550100 \n \n \n\n \n Apply\n \n \n \n \n \n\n"
## [253] "Simple Search of Our Archives\n \n \n \n \n \n\n \n \n \n \n \n \n \n \n \n \n\n \n # per page\n5102550100 \n \n \n\n \n Apply\n \n \n \n \n \n\n"
## [254] "Simple Search of Our Archives"
## [255] " \n \n \n \n\n \n \n \n \n \n \n \n \n \n \n\n \n # per page\n5102550100 \n \n \n\n \n Apply\n \n \n \n \n \n"
## [256] " \n \n \n \n\n \n \n \n \n \n \n \n \n \n \n\n \n # per page\n5102550100 \n \n \n\n \n Apply\n \n \n \n \n \n"
## [257] "\n \n \n \n\n \n \n \n \n \n \n \n \n \n \n\n \n # per page\n5102550100 \n \n \n\n \n Apply\n \n \n \n \n "
## [258] "\n \n \n\n \n \n \n \n \n \n \n \n \n \n\n \n # per page\n5102550100 \n \n \n\n \n Apply\n \n \n \n "
## [259] "\n \n\n \n \n \n "
## [260] "\n \n \n "
## [261] " "
## [262] ""
## [263] ""
## [264] "\n "
## [265] "\n "
## [266] "\n \n\n \n # per page\n5102550100 \n \n \n\n \n Apply\n \n \n "
## [267] "\n \n # per page\n5102550100 \n "
## [268] " # per page\n5102550100"
## [269] "# per page"
## [270] "5102550100"
## [271] "5"
## [272] "10"
## [273] "25"
## [274] "50"
## [275] "100"
## [276] "\n \n Apply\n \n "
## [277] "Apply"
## [278] "\n \n \n \n \n \n \n Report a Typo \n \n \n \n \n \n \n \n "
## [279] "\n \n \n \n \n \n Report a Typo \n \n \n \n \n \n \n \n"
## [280] "\n \n \n Report a Typo \n "
## [281] "\n \n Report a Typo "
## [282] " Report a Typo "
## [283] "Report a Typo"
## [284] "Report a Typo"
## [285] "Report a Typo"
## [286] "\n \n The American Presidency ProjectJohn Woolley and Gerhard PetersContact\n\nTwitter Facebook\n\nCopyright © The American Presidency ProjectTerms of Service | Privacy | Accessibility\n\n \n "
## [287] "\n \n The American Presidency ProjectJohn Woolley and Gerhard PetersContact\n\nTwitter Facebook\n\nCopyright © The American Presidency ProjectTerms of Service | Privacy | Accessibility\n\n "
## [288] "\n The American Presidency ProjectJohn Woolley and Gerhard PetersContact\n\nTwitter Facebook\n\nCopyright © The American Presidency ProjectTerms of Service | Privacy | Accessibility\n"
## [289] "The American Presidency ProjectJohn Woolley and Gerhard PetersContact\n\n"
## [290] "The American Presidency ProjectJohn Woolley and Gerhard PetersContact"
## [291] "The American Presidency Project"
## [292] ""
## [293] ""
## [294] "Contact"
## [295] "Contact"
## [296] "Twitter Facebook\n\n"
## [297] "Twitter Facebook"
## [298] "Twitter"
## [299] "Facebook"
## [300] "Copyright © The American Presidency ProjectTerms of Service | Privacy | Accessibility\n"
## [301] "Copyright © The American Presidency ProjectTerms of Service | Privacy | Accessibility"
## [302] ""
## [303] "Terms of Service"
## [304] "Privacy"
## [305] "Accessibility"
## [306] ""
## [307] ""
## [308] ""
## [309] ""
## [310] "window.NREUM||(NREUM={});NREUM.info={\"beacon\":\"bam-cell.nr-data.net\",\"licenseKey\":\"dee899de70\",\"applicationID\":\"80106271\",\"transactionName\":\"bl1XYxNYWkVYVxFdWVcXdFQVUFtYFlAWa1NBTEdWEmZaWV1ROkRXXl1qQQhcQw==\",\"queueTime\":0,\"applicationTime\":611,\"atts\":\"QhpUFVtCSUs=\",\"errorBeacon\":\"bam-cell.nr-data.net\",\"agent\":\"\"}"
We will learn how to select parts of specific webpages soon. However, since webpages are built with a similar architecture, often, we get quite far by selecting generic elements.
Visit the webpage of the guardian and extract the headlines of different levels until you do not find anything anymore. Can you identify how the different levels are used in the webpage by looking at the original page? Remember that since this is a new webpage, you will have to combine the commands we have learned so far, namely read_html()
, html_elements()
and html_text()
.
guardian <- read_html("https://www.theguardian.com/")
guardian %>% html_elements("h1") %>% html_text()
## [1] "News, sport and opinion from the Guardian's global edition"
## [2] " Welcome to Ontario "
guardian %>% html_elements("h1") %>% html_text()
## [1] "News, sport and opinion from the Guardian's global edition"
## [2] " Welcome to Ontario "
guardian %>% html_elements("h2") %>% html_text()
## [1] "Palette styles new do not delete"
## [2] "Headlines"
## [3] "Ukraine invasion"
## [4] "Ukraine invasion in focus"
## [5] "Spotlight"
## [6] "Opinion"
## [7] "Sport"
## [8] "This is Europe"
## [9] "Climate crisis"
## [10] "Around the world"
## [11] "Contact the Guardian"
## [12] "Culture"
## [13] " \n From Toronto to Ottawa Ten of the best things to see and do in urban Ontario – in pictures "
## [14] " \n The 1,000 islands and Niagara Falls 10 of the best ways to see Ontario’s awesome outdoors – in pictures "
## [15] " From eggs benedict to the ultimate bacon roll Toronto’s best places to eat "
## [16] " The perfect place for hiking, camping and wildlife Six reasons a north Londoner fell in love with Ontario "
## [17] "Lifestyle"
## [18] "Explore"
## [19] "Take part"
## [20] "Today in Focus"
## [21] " \n \n Podcast\n \n \n Putin’s dilemma: what is his next move in Ukraine? \n "
## [22] " Listen to previous episodes "
## [23] " Videos "
## [24] "In pictures"
guardian %>% html_elements("h3") %>% html_text()
## [1] "Revealed The ‘carbon bombs’ set to trigger catastrophic climate breakdown "
## [2] "Exclusive Ukraine prosecutors ready to launch first war crimes trials of Russia conflict "
## [3] "Live Russia-Ukraine war: UK pledges support if Sweden attacked; Russia negotiations harder ‘with each new Bucha’, says Zelenskiy "
## [4] "Shireen Abu Akleh Al Jazeera accuses Israeli forces of killing journalist in West Bank "
## [5] "Brexit UK’s threat to Northern Ireland protocol is boost to Putin, say EU insiders "
## [6] "Hong Kong National security police arrest Cardinal Joseph Zen "
## [7] "Germany Lufthansa apologises after barring Orthodox Jewish travellers from flight "
## [8] "Twitter Reversing Trump ban will provoke user backlash, Elon Musk warned "
## [9] "‘Wagatha Christie’ case Vardy says she tried to leak Drinkwater story to the Sun "
## [10] "George Grosz Museum dedicated to city’s master chronicler opens in Berlin "
## [11] "Kherson Military administrators to call for Russian annexation "
## [12] "Full report Russian invasion in eastern Ukraine reaching stalemate, says US official "
## [13] "UK Ukraine refugees who enter UK via Ireland may be sent to Rwanda, MPs told "
## [14] "Foreign policy UK pledges to back Sweden and Finland against Russian threats "
## [15] "Ukraine’s ‘hero river’ It helped save Kyiv. But what now for its newly restored wetlands? "
## [16] "In pictures Inside the Azovstal steelworks "
## [17] "At a glance What we know on day 77 of Russia’s invasion "
## [18] "Exclusive John Kerry warns a long Ukraine war would threaten climate efforts "
## [19] "Zero-rated? The rise and rise of TV that absolutely no one is watching "
## [20] "Shireen Abu Akleh killing ‘She was the voice of events in Palestine’ "
## [21] "Eric Johnson’s best photograph Biggie kept saying: ‘Is this where they dump the dead bodies?’ "
## [22] "Soy Cromwell! Babe actor’s Starbucks plant milk protest shows why he’s movies’ top revolutionary "
## [23] "Tickets, passport … picnic? Why you may have to rustle up your own in-flight meal "
## [24] "Life on the edge Land loss on England’s east coast – a photo essay "
## [25] "DJ Luke Una ‘With ADHD, life can be torturous. Music stops the noise’ "
## [26] "Our Father review An undeniably gripping tale of a fertility doctor’s shocking crimes "
## [27] " \n This British ‘bill of rights’ is constitutional butchery that will make us all less free "
## [28] " \n RIP the iPod. I resisted you at first, but for 20 years, you were my musical life "
## [29] " \n How do I know I’m getting old? My children worry about me – and I’m exhausted by half-time "
## [30] " \n Dear Coldplay, listen to Massive Attack and save yourselves from greenwashing "
## [31] " \n The second American civil war is already happening "
## [32] " \n How to stop the sleazy rot in Westminster? Send in the mums "
## [33] "Cricket McCullum set to be appointed England men’s Test coach "
## [34] "Tennis Nadal takes positive step back from injury with win over Isner "
## [35] "Olympic boxing at risk IOC warns Iba amid fresh governance worries "
## [36] " \n Players taking Saudi money for weak events is a bad look for golf "
## [37] "The Spin Is new women’s T20 tournament in Dubai a sign of progress or a threat? "
## [38] "Moving the Goalposts Anita Asante: ‘I said to Gerrard, let’s hug because my hands are really sweaty’ "
## [39] "Aston Villa 1-2 Liverpool Klopp says Reds ‘still chasing like mad’ for league title "
## [40] " \n Haaland is a fantasy player but he or City will have to change "
## [41] "Sri Lanka Country is the first domino to fall in the face of a global debt crisis "
## [42] "Russia Putin uses Victory Day speech to rehash list of grievances against west "
## [43] "‘I wept with joy’ Young director made guardian of Italy’s temples of Paestum "
## [44] " ‘I am filled with hate’ Kharkiv battle evokes memories of second world war "
## [45] "‘Devastating’ 90% of reefs surveyed on Great Barrier Reef affected by coral bleaching in 2022 "
## [46] "‘People laugh but think twice’ Belgian cartoonist takes on plastic pollution "
## [47] "Airline emissions Just one of 50 aviation industry climate targets met, study finds "
## [48] "Climate crisis 1.5C limit close to being broken, scientists warn "
## [49] "Live Democrat Joe Manchin says he will vote no on guaranteeing abortion rights "
## [50] "France TV news presenter faces multiple allegations of sex offences "
## [51] "Italy Elite mountain troops face inquiry over harassment claims "
## [52] "Sri Lanka unrest Shoot on sight order issued as troops deployed in Colombo "
## [53] "World Bank War leads to surge in money transfers to Ukraine "
## [54] "Didi Chinese taxi app shelves plans for major overseas expansion "
## [55] "Cryptocurrencies Could Terra fall prove to be Lehman Brothers moment for crytocurrencies? "
## [56] "Business US inflation rate slows but remains close to 40-year high "
## [57] "France Man accused of suffocating woman with madeleine cake "
## [58] "US Texas court ordered to reconsider decision to uphold prison sentence for woman who voted "
## [59] "‘We had a seething disdain for each other’ Jake Chapman on splitting from brother Dinos "
## [60] " \n Chris Rock in a hard place: will he make comedy gold out of Will Smith’s slap? "
## [61] "Assemble unleash squidgy mayhem \n We didn’t think they’d use the animals as trampolines "
## [62] "Top 10 Novels about neighbours "
## [63] "Late-night TV roundup Kimmel on baby formula shortage: ‘Never been a better time to force women to have kids’ "
## [64] "Lolly Adefope’s year in TV ‘We made a sex tape in Shrill – some of the noises I made were unacceptable’ "
## [65] "‘People say they want me arrested’ The owners putting their pets on vegan diets "
## [66] "Felicity Cloake's masterclass How to make bakewell tart – recipe "
## [67] "A moment that changed me \n A rare condition left me fighting to breathe – and repaired my marriage "
## [68] "The long read Spot the difference: the invincible business of counterfeit goods "
## [69] "Kitchen aide What’s the best alternative to clingfilm? "
## [70] "Sexual healing After 10 years of hiding affairs, my partner has declared we’re in an open relationship. I feel broken "
## [71] "‘It was as if he set out to destroy my sanity’ How the spy cops lied their way into women’s hearts – and beds "
## [72] "Finding it hard to get a new job? Robot recruiters might be to blame "
## [73] "Solution or hazard? Fate of California desalination plant hangs in the balance "
## [74] "US Pro-choice states rush to pledge legal shield for out-of-state abortions "
## [75] "‘How many more months should we suffer?’ Indonesians struggle with pricey cooking oil "
## [76] "‘I lost a bunch of things’ Homeless New Yorkers struggle amid police sweeps "
## [77] "Influencers Have you struggled to make money from social media? "
## [78] "Apple Share your memories of your first iPod "
## [79] "Tell us How have you been affected by the situation in Ukraine? "
## [80] "Get in touch Share a story with the Guardian "
## [81] "Philippines Protests erupt as son of late dictator wins presidency "
## [82] "Putin's Russia From KGB agent to Kremlin operator "
## [83] "‘They want to destroy our culture’ Russian strike hits museum in Ukrainian town "
## [84] "Made in London Solidarity Britannia "
## [85] "Wednesday’s best photos A goldeneye, a stingray and an Indian summer "
## [86] "The golden city A history of San Francisco "
## [87] "Painters, posers and poodles Peter Fetterman’s favourite images "
## [88] "Hats off! How Frank Horvat changed fashion photography "
## [89] "The Guardian picture essay Romania’s last peasant women "
## [90] "TV Baftas 2022 Backstage with Ncuti Gatwa, Olivia Colman and more – in pictures "
## [91] " Russian invasion in eastern Ukraine reaching stalemate, says US official "
## [92] "Live Russia-Ukraine war: UK pledges support if Sweden attacked; Russia negotiations harder ‘with each new Bucha’, says Zelenskiy – live "
## [93] " Ukraine prosecutors ready to launch first war crimes trials of Russia conflict "
## [94] " Lufthansa apologises after barring Orthodox Jewish travellers from flight "
## [95] " Inside the Azovstal steelworks – in pictures "
## [96] " Al Jazeera accuses Israeli forces of killing journalist in West Bank "
## [97] " Are Canadians being driven to assisted suicide by poverty or healthcare crisis? "
## [98] " Putin could use nuclear weapon if he felt war being lost – US intelligence chief "
## [99] " French man accused of suffocating woman with madeleine cake "
## [100] " ‘Republican and more Republican’: Idaho shifts ever rightward "
guardian %>% html_elements("h4") %>% html_text()
## [1] " US Fracking boom could tip world to edge of climate disaster "
## [2] " US Fracking boom could tip world to edge of climate disaster "
## [3] " Tennis Raducanu’s injury woes continue with Rome exit "
## [4] " Tennis Raducanu’s injury woes continue with Rome exit "
## [5] " The Recap Sign up and get our email of editors' picks "
## [6] " The Recap Sign up and get our email of editors' picks "
## [7] " US Senate Mitch McConnell says Republicans couldn’t pass abortion ban "
## [8] " US Senate Mitch McConnell says Republicans couldn’t pass abortion ban "
Now that we practiced the html_elements()
command a bit, we move beyond just selecting all headlines, all links etc. towards specific headlines, links or elements more generally.
Basically, HTML Tags describe the formatting and structure of a webpage. CSS selectors are a type of grammar or pattern-description that helps us select specific parts of that structure depending on the look, positioning etc. For this we use the classes and attributes that further define HTML tags.
CSS selectors follow a specific grammar that you do not need to memorize but might want to look up when you are scraping. Below, you find an overview of this grammar.
* | universal selector | Matches everything. |
element | type selector | Matches an element |
[attribute] | attribute selector | Matches elements containing a given attribute |
[attribute=value] | attribute selector | Matches elements containing a given attribute with a given value |
.class | class selector | Matches the value of a class attribute |
#id | ID selector | Matches the value of an id attribute |
[attribute*=value] | Matches elements with an attribute that contains a given value | a[href*=“pressrelease”] |
[attribute^=“value”] | Matches elements with an attribute that starts with a given value | a[href*=“/press/”] |
[attribute$=“value”] | Matches elements with an attribute that ends with a given value | [href$=“.pdf”] |
There are several ways to combine CSS Selectors:
element,element | Selects all <>div> elements and all <>p> elements | div, p |
element element | Selects all <>p> elements inside <>div> elements | div p |
element>element | Selects all <>p> elements where the parent is a <>div> element | div > p |
element+element | Selects all <>p> elements that are placed immediately after <>div> elements | div + p |
element1~element2 | Selects every <ul> element that are preceded by a <p> element | p ~ ul |
If you want to practice CSS Selectors, the w3schools has a test playground where you can try out lots of more complex selectors and read up on them.
If you want to practice the logic of CSS Selectors in a fun way, play with the CSS Diner where you can also learn about different selector structures.
While understanding HTML helps, we often do not need to engage with the code because there are lots of tools to help us. That is: We can get some help at doing many of the things we just learned painfully!
For example, SelectorGadget is a JavaScript bookmarklet that allows you to interactively figure out what css selector you need to extract parts of the page. If you have not heard of selectorgadget, check its webpage.
We will try to use SelectorGadget now. If you have Chrome, you can just install SelectorGadget in your browser. If you have a different browser, drag this link into your bookmark bar and click on it when needed. Now, use it to select the text on the speech webpage you have used.
Now, we try to use these CSS Selectors with the html_elements()
command. This is a bit of repetition from before but it aids the memory: Parse the page, use the CSS selector to select only the text of the speech assign it to a new object selected
. Then, inspect the results by calling the object!
speech <- read_html("https://www.presidency.ucsb.edu/documents/statement-administration-policy-hj-res-46-terminating-the-national-emergency-declared-the")
selected <- html_elements(speech,".field-docs-content")
selected
## {xml_nodeset (1)}
## [1] <div class="field-docs-content">\n <p></p>\n<center><b>STATEMENT OF AD ...
This already looks more structured - but we should get rid of the HTML tags. Apply the html_text()
command we used before to the elements which we selected in the last step. This way, we get just the text from the elements we selected.
html_text(selected)
## [1] "\n STATEMENT OF ADMINISTRATION POLICY\n(House)(Rep. Castro, D-TX, and 233 cosponsors)\nThe Administration strongly opposes H.J. Res. 46. The current situation at the Southern Border presents a humanitarian and security crisis that threatens core national security interests and constitutes a national emergency. The Southern Border is a major entry point for criminals, gang members, and illicit narcotics. The problem of large-scale unlawful migration through the Southern Border is enduring, and, despite the Administration's use of existing statutory authorities, in recent years the situation has worsened in certain respects. In particular, we have recently seen sharp increases in the number of illegal entrances into the United States of family units, unaccompanied minors, and persons claiming a fear of return—aliens whom the Administration is largely unable to detain or remove because of antiquated laws and problematic court decisions.\nThe resolution would terminate the national emergency declared by the President on February 15, 2019, and undermine the Administration's ability to respond effectively to the ongoing crisis at the Southern Border. The President's emergency declaration, and his further determination that the emergency requires the use of the Armed Forces, allowed the President to invoke the construction authority provided in 10 U.S.C. 2808, and made that authority available to the Secretary of Defense, within his discretion, to undertake military construction projects that are necessary to support such use of the Armed Forces. This is the same authority that President George W. Bush and President Barack Obama used to undertake more than 18 different military construction projects between 2001 and 2013.\nIf H.J. Res. 46 were presented to the President in its current form, his advisors would recommend that he veto it.\n "
So, you have learned how to use some of the basic functions of the rvest
package: read_html()
, html_elements()
, html_table()
and html_text()
. But most of the time, we are not just interested in a single page but multiple pages from the same domain, e.g. all newspaper reports by a specific newspaper or all speeches by a politician. So we need another step: We have to learn to follow links without actually opening the browser and clicking on the link and copying the new path.
Now, we will learn two things:
To extract links, we need another command. Remember that hyperlinks are an attribute of the text? This means, they are not directly visible on the page but bare an attribute of the elements we see. Because of that, the rvest
command to get these links is called html_attr()
. We can use it to extract different types of attributes, so you will have to tell rvest the attribute that we are interested in is a link. Remember what links looked like?
This is text <a href="https://www.presidency.ucsb.edu/">with a link</a>.
href stands for hyperreference and signifies the webpage the link leads to. You can specify name="href"
inside the html_attr()
command to extract the link. For example:
html_attr(object,"href")
However, this will only work on individual HTML tags not on entire pages (since the link is an attribute of the specific tag, not the page), so we will use html_elements()
again. Please try three things on the original search result overview page you stored:
html_elements("*")
)searchresults <- read_html("https://www.presidency.ucsb.edu/advanced-search?field-keywords=crisis&items_per_page=25")
searchresults %>% html_elements("*") %>% html_attr("href")
## [1] NA
## [2] NA
## [3] NA
## [4] NA
## [5] NA
## [6] NA
## [7] "https://www.presidency.ucsb.edu/sites/default/files/favicon-app_0.png"
## [8] NA
## [9] "//fonts.googleapis.com/css?family=Open+Sans:400,400italic,800,700,600,300|Dosis:400,200,300,500,600,700,800"
## [10] "//netdna.bootstrapcdn.com/bootstrap/3.0.0/css/bootstrap-glyphicons.css"
## [11] "https://www.presidency.ucsb.edu/sites/default/files/css/css_lQaZfjVpwP_oGNqdtWCSpJT1EMqXdMiU84ekLLxQnc4.css"
## [12] "https://www.presidency.ucsb.edu/sites/default/files/css/css_V51jPozROoS3_TR4sC5mglxGJf40xpH6JGUK2rrUdbA.css"
## [13] "https://www.presidency.ucsb.edu/sites/default/files/css/css_Cq1R3m_ERXC2ynYnp57HZ-O7ehprd9pvLTuV32DY_ow.css"
## [14] "https://www.presidency.ucsb.edu/sites/default/files/css/css_eqOQxIRcuNwVxaE5_kFXv5rqLB4z-0RNOVYITwsGDBg.css"
## [15] "https://www.presidency.ucsb.edu/sites/default/files/css/css_gsVew5cLoW8YoOz5wlq-MSojac7Ph5f6cujHg4HQfcM.css"
## [16] "https://www.presidency.ucsb.edu/sites/default/files/css/css_DW59q6nX-P3-D4cA08_V2iLlMJIaFdPFYT8X6nSFpV8.css"
## [17] NA
## [18] NA
## [19] NA
## [20] NA
## [21] NA
## [22] NA
## [23] NA
## [24] NA
## [25] NA
## [26] NA
## [27] NA
## [28] NA
## [29] NA
## [30] NA
## [31] NA
## [32] NA
## [33] NA
## [34] NA
## [35] "#main-content"
## [36] NA
## [37] NA
## [38] NA
## [39] NA
## [40] NA
## [41] NA
## [42] "https://www.presidency.ucsb.edu/"
## [43] NA
## [44] NA
## [45] "https://www.presidency.ucsb.edu/about"
## [46] "/advanced-search"
## [47] NA
## [48] NA
## [49] "https://www.ucsb.edu/"
## [50] NA
## [51] NA
## [52] NA
## [53] NA
## [54] NA
## [55] NA
## [56] NA
## [57] NA
## [58] NA
## [59] NA
## [60] NA
## [61] NA
## [62] NA
## [63] "/documents"
## [64] NA
## [65] NA
## [66] NA
## [67] "/documents/presidential-documents-archive-guidebook"
## [68] NA
## [69] "/documents/category-attributes"
## [70] NA
## [71] "/statistics"
## [72] NA
## [73] "/media"
## [74] NA
## [75] "/presidents"
## [76] NA
## [77] "/analyses"
## [78] NA
## [79] "https://giving.ucsb.edu/Funds/Give?id=185"
## [80] NA
## [81] NA
## [82] NA
## [83] NA
## [84] NA
## [85] NA
## [86] NA
## [87] NA
## [88] NA
## [89] NA
## [90] NA
## [91] NA
## [92] NA
## [93] NA
## [94] NA
## [95] NA
## [96] NA
## [97] NA
## [98] NA
## [99] NA
## [100] NA
## [101] NA
## [102] NA
## [103] NA
## [104] NA
## [105] NA
## [106] NA
## [107] NA
## [108] NA
## [109] NA
## [110] NA
## [111] NA
## [112] NA
## [113] NA
## [114] NA
## [115] NA
## [116] NA
## [117] NA
## [118] NA
## [119] NA
## [120] NA
## [121] NA
## [122] NA
## [123] NA
## [124] "https://www.presidency.ucsb.edu/how-to-search"
## [125] NA
## [126] NA
## [127] NA
## [128] NA
## [129] NA
## [130] NA
## [131] NA
## [132] NA
## [133] NA
## [134] NA
## [135] NA
## [136] NA
## [137] NA
## [138] NA
## [139] NA
## [140] NA
## [141] NA
## [142] NA
## [143] NA
## [144] NA
## [145] NA
## [146] NA
## [147] NA
## [148] NA
## [149] NA
## [150] NA
## [151] NA
## [152] NA
## [153] NA
## [154] NA
## [155] NA
## [156] NA
## [157] NA
## [158] NA
## [159] NA
## [160] NA
## [161] NA
## [162] NA
## [163] NA
## [164] NA
## [165] NA
## [166] NA
## [167] NA
## [168] NA
## [169] NA
## [170] NA
## [171] NA
## [172] NA
## [173] NA
## [174] NA
## [175] NA
## [176] NA
## [177] NA
## [178] NA
## [179] NA
## [180] NA
## [181] NA
## [182] NA
## [183] NA
## [184] NA
## [185] NA
## [186] NA
## [187] NA
## [188] NA
## [189] NA
## [190] NA
## [191] NA
## [192] NA
## [193] NA
## [194] NA
## [195] NA
## [196] NA
## [197] NA
## [198] NA
## [199] NA
## [200] NA
## [201] NA
## [202] NA
## [203] NA
## [204] NA
## [205] NA
## [206] NA
## [207] NA
## [208] NA
## [209] NA
## [210] NA
## [211] NA
## [212] NA
## [213] NA
## [214] NA
## [215] NA
## [216] NA
## [217] NA
## [218] NA
## [219] NA
## [220] NA
## [221] NA
## [222] NA
## [223] NA
## [224] NA
## [225] NA
## [226] NA
## [227] NA
## [228] NA
## [229] NA
## [230] NA
## [231] NA
## [232] NA
## [233] NA
## [234] NA
## [235] NA
## [236] NA
## [237] NA
## [238] NA
## [239] NA
## [240] NA
## [241] NA
## [242] NA
## [243] NA
## [244] NA
## [245] NA
## [246] NA
## [247] NA
## [248] NA
## [249] NA
## [250] NA
## [251] NA
## [252] NA
## [253] NA
## [254] NA
## [255] NA
## [256] NA
## [257] NA
## [258] NA
## [259] NA
## [260] NA
## [261] NA
## [262] NA
## [263] NA
## [264] NA
## [265] NA
## [266] NA
## [267] NA
## [268] NA
## [269] NA
## [270] NA
## [271] NA
## [272] NA
## [273] NA
## [274] NA
## [275] NA
## [276] NA
## [277] NA
## [278] NA
## [279] NA
## [280] NA
## [281] NA
## [282] NA
## [283] NA
## [284] NA
## [285] NA
## [286] NA
## [287] NA
## [288] NA
## [289] NA
## [290] NA
## [291] NA
## [292] NA
## [293] NA
## [294] NA
## [295] NA
## [296] NA
## [297] NA
## [298] NA
## [299] NA
## [300] NA
## [301] NA
## [302] NA
## [303] NA
## [304] NA
## [305] NA
## [306] NA
## [307] NA
## [308] NA
## [309] NA
## [310] NA
## [311] NA
## [312] NA
## [313] NA
## [314] NA
## [315] NA
## [316] NA
## [317] NA
## [318] NA
## [319] NA
## [320] NA
## [321] NA
## [322] NA
## [323] NA
## [324] NA
## [325] NA
## [326] NA
## [327] NA
## [328] NA
## [329] NA
## [330] NA
## [331] NA
## [332] NA
## [333] NA
## [334] NA
## [335] NA
## [336] NA
## [337] NA
## [338] NA
## [339] NA
## [340] NA
## [341] NA
## [342] NA
## [343] NA
## [344] NA
## [345] NA
## [346] NA
## [347] NA
## [348] NA
## [349] NA
## [350] NA
## [351] NA
## [352] NA
## [353] NA
## [354] NA
## [355] NA
## [356] NA
## [357] NA
## [358] NA
## [359] NA
## [360] NA
## [361] NA
## [362] NA
## [363] NA
## [364] NA
## [365] NA
## [366] NA
## [367] NA
## [368] NA
## [369] NA
## [370] NA
## [371] NA
## [372] NA
## [373] NA
## [374] NA
## [375] NA
## [376] NA
## [377] NA
## [378] NA
## [379] NA
## [380] NA
## [381] NA
## [382] NA
## [383] NA
## [384] NA
## [385] NA
## [386] NA
## [387] NA
## [388] NA
## [389] NA
## [390] NA
## [391] NA
## [392] NA
## [393] NA
## [394] NA
## [395] NA
## [396] NA
## [397] NA
## [398] NA
## [399] NA
## [400] NA
## [401] NA
## [402] NA
## [403] NA
## [404] NA
## [405] NA
## [406] NA
## [407] NA
## [408] NA
## [409] NA
## [410] NA
## [411] NA
## [412] NA
## [413] NA
## [414] NA
## [415] NA
## [416] NA
## [417] NA
## [418] NA
## [419] NA
## [420] NA
## [421] NA
## [422] NA
## [423] NA
## [424] NA
## [425] NA
## [426] NA
## [427] NA
## [428] NA
## [429] NA
## [430] NA
## [431] NA
## [432] NA
## [433] NA
## [434] NA
## [435] NA
## [436] NA
## [437] NA
## [438] NA
## [439] NA
## [440] NA
## [441] NA
## [442] NA
## [443] NA
## [444] NA
## [445] NA
## [446] NA
## [447] NA
## [448] NA
## [449] NA
## [450] NA
## [451] NA
## [452] NA
## [453] NA
## [454] NA
## [455] NA
## [456] NA
## [457] NA
## [458] NA
## [459] NA
## [460] NA
## [461] NA
## [462] NA
## [463] NA
## [464] NA
## [465] NA
## [466] NA
## [467] NA
## [468] NA
## [469] NA
## [470] NA
## [471] NA
## [472] NA
## [473] NA
## [474] NA
## [475] NA
## [476] NA
## [477] NA
## [478] NA
## [479] NA
## [480] NA
## [481] NA
## [482] NA
## [483] NA
## [484] NA
## [485] NA
## [486] NA
## [487] NA
## [488] NA
## [489] NA
## [490] NA
## [491] NA
## [492] NA
## [493] NA
## [494] NA
## [495] NA
## [496] NA
## [497] NA
## [498] NA
## [499] NA
## [500] NA
## [501] NA
## [502] NA
## [503] NA
## [504] NA
## [505] NA
## [506] NA
## [507] NA
## [508] NA
## [509] NA
## [510] NA
## [511] NA
## [512] NA
## [513] NA
## [514] NA
## [515] NA
## [516] NA
## [517] NA
## [518] NA
## [519] NA
## [520] NA
## [521] NA
## [522] NA
## [523] NA
## [524] NA
## [525] NA
## [526] NA
## [527] NA
## [528] NA
## [529] NA
## [530] NA
## [531] NA
## [532] NA
## [533] NA
## [534] NA
## [535] NA
## [536] NA
## [537] NA
## [538] NA
## [539] NA
## [540] NA
## [541] NA
## [542] NA
## [543] NA
## [544] NA
## [545] NA
## [546] NA
## [547] NA
## [548] NA
## [549] NA
## [550] NA
## [551] NA
## [552] NA
## [553] NA
## [554] NA
## [555] NA
## [556] NA
## [557] NA
## [558] NA
## [559] NA
## [560] NA
## [561] NA
## [562] NA
## [563] NA
## [564] NA
## [565] NA
## [566] NA
## [567] NA
## [568] NA
## [569] NA
## [570] NA
## [571] NA
## [572] NA
## [573] "/advanced-search?field-keywords=crisis&items_per_page=25&field-keywords2=&field-keywords3=&from&to&person2=&&order=field_docs_start_date_time_value&sort=asc"
## [574] NA
## [575] "/advanced-search?field-keywords=crisis&items_per_page=25&field-keywords2=&field-keywords3=&from&to&person2=&&order=field_docs_person&sort=asc"
## [576] NA
## [577] NA
## [578] NA
## [579] NA
## [580] NA
## [581] "/people/president/george-washington"
## [582] NA
## [583] "/documents/inaugural-address-16"
## [584] NA
## [585] NA
## [586] NA
## [587] NA
## [588] NA
## [589] "/people/president/george-washington"
## [590] NA
## [591] "/documents/message-reply-the-senate-10"
## [592] NA
## [593] NA
## [594] NA
## [595] NA
## [596] NA
## [597] "/people/president/george-washington"
## [598] NA
## [599] "/documents/special-message-3786"
## [600] NA
## [601] NA
## [602] NA
## [603] NA
## [604] NA
## [605] "/people/president/george-washington"
## [606] NA
## [607] "/documents/sixth-annual-address-congress"
## [608] NA
## [609] NA
## [610] NA
## [611] NA
## [612] NA
## [613] "/people/president/george-washington"
## [614] NA
## [615] "/documents/message-reply-the-house-representatives-0"
## [616] NA
## [617] NA
## [618] NA
## [619] NA
## [620] NA
## [621] "/people/president/john-adams"
## [622] NA
## [623] "/documents/inaugural-address-18"
## [624] NA
## [625] NA
## [626] NA
## [627] NA
## [628] NA
## [629] "/people/president/john-adams"
## [630] NA
## [631] "/documents/address-joint-session-congress-relations-with-france"
## [632] NA
## [633] NA
## [634] NA
## [635] NA
## [636] NA
## [637] "/people/president/john-adams"
## [638] NA
## [639] "/documents/message-reply-the-house-representatives-5"
## [640] NA
## [641] NA
## [642] NA
## [643] NA
## [644] NA
## [645] "/people/president/john-adams"
## [646] NA
## [647] "/documents/letter-john-adams-from-george-washington"
## [648] NA
## [649] NA
## [650] NA
## [651] NA
## [652] NA
## [653] "/people/president/john-adams"
## [654] NA
## [655] "/documents/message-reply-the-house-representatives-4"
## [656] NA
## [657] NA
## [658] NA
## [659] NA
## [660] NA
## [661] "/people/president/john-adams"
## [662] NA
## [663] "/documents/special-message-2941"
## [664] NA
## [665] NA
## [666] NA
## [667] NA
## [668] NA
## [669] "/people/president/thomas-jefferson"
## [670] NA
## [671] "/documents/inaugural-address-20"
## [672] NA
## [673] NA
## [674] NA
## [675] NA
## [676] NA
## [677] "/people/president/thomas-jefferson"
## [678] NA
## [679] "/documents/special-message-1828"
## [680] NA
## [681] NA
## [682] NA
## [683] NA
## [684] NA
## [685] "/people/president/thomas-jefferson"
## [686] NA
## [687] "/documents/proclamation-14-requiring-removal-british-armed-vessels-from-united-states-ports-and"
## [688] NA
## [689] NA
## [690] NA
## [691] NA
## [692] NA
## [693] "/people/president/thomas-jefferson"
## [694] NA
## [695] "/documents/special-message-2565"
## [696] NA
## [697] NA
## [698] NA
## [699] NA
## [700] NA
## [701] "/people/president/thomas-jefferson"
## [702] NA
## [703] "/documents/special-message-2561"
## [704] NA
## [705] NA
## [706] NA
## [707] NA
## [708] NA
## [709] "/people/president/thomas-jefferson"
## [710] NA
## [711] "/documents/special-message-2177"
## [712] NA
## [713] NA
## [714] NA
## [715] NA
## [716] NA
## [717] "/people/president/thomas-jefferson"
## [718] NA
## [719] "/documents/eighth-annual-message"
## [720] NA
## [721] NA
## [722] NA
## [723] NA
## [724] NA
## [725] NA
## [726] "/people/president/james-madison"
## [727] NA
## [728] "/documents/proclamation-16-taking-possession-part-louisiana-annexation-west-florida"
## [729] NA
## [730] NA
## [731] NA
## [732] NA
## [733] NA
## [734] "/people/president/james-madison"
## [735] NA
## [736] "/documents/third-annual-message-0"
## [737] NA
## [738] NA
## [739] NA
## [740] NA
## [741] NA
## [742] NA
## [743] "/people/president/james-madison"
## [744] NA
## [745] "/documents/special-message-887"
## [746] NA
## [747] NA
## [748] NA
## [749] NA
## [750] NA
## [751] "/people/president/james-madison"
## [752] NA
## [753] "/documents/message-the-senate-returning-without-approval-act-incorporate-the-subscribers-the-bank-the"
## [754] NA
## [755] NA
## [756] NA
## [757] NA
## [758] NA
## [759] "/people/president/james-monroe"
## [760] NA
## [761] "/documents/inaugural-address-23"
## [762] NA
## [763] NA
## [764] NA
## [765] NA
## [766] NA
## [767] "/people/president/james-monroe"
## [768] NA
## [769] "/documents/eighth-annual-message-1"
## [770] NA
## [771] NA
## [772] NA
## [773] NA
## [774] NA
## [775] "/people/president/john-quincy-adams"
## [776] NA
## [777] "/documents/executive-order"
## [778] NA
## [779] NA
## [780] NA
## [781] NA
## [782] NA
## [783] NA
## [784] NA
## [785] "/advanced-search?field-keywords=crisis&items_per_page=25&page=1"
## [786] NA
## [787] "/advanced-search?field-keywords=crisis&items_per_page=25&page=2"
## [788] NA
## [789] "/advanced-search?field-keywords=crisis&items_per_page=25&page=3"
## [790] NA
## [791] "/advanced-search?field-keywords=crisis&items_per_page=25&page=4"
## [792] NA
## [793] "/advanced-search?field-keywords=crisis&items_per_page=25&page=5"
## [794] NA
## [795] "/advanced-search?field-keywords=crisis&items_per_page=25&page=6"
## [796] NA
## [797] "/advanced-search?field-keywords=crisis&items_per_page=25&page=7"
## [798] NA
## [799] "/advanced-search?field-keywords=crisis&items_per_page=25&page=8"
## [800] NA
## [801] NA
## [802] NA
## [803] "/advanced-search?field-keywords=crisis&items_per_page=25&page=1"
## [804] NA
## [805] "/advanced-search?field-keywords=crisis&items_per_page=25&page=522"
## [806] NA
## [807] NA
## [808] NA
## [809] NA
## [810] NA
## [811] NA
## [812] NA
## [813] NA
## [814] NA
## [815] "https://www.presidency.ucsb.edu/contact"
## [816] NA
## [817] NA
## [818] "https://twitter.com/presidency_proj"
## [819] "https://www.facebook.com/pg/american.presidency.project/"
## [820] NA
## [821] NA
## [822] NA
## [823] "http://www.ucsb.edu/terms-of-use"
## [824] "http://www.policy.ucsb.edu/privacy-notification/"
## [825] "/accessibility"
## [826] NA
## [827] NA
## [828] NA
## [829] NA
## [830] NA
searchresults %>% html_elements("a") %>% html_attr("href")
## [1] "#main-content"
## [2] "https://www.presidency.ucsb.edu/"
## [3] "https://www.presidency.ucsb.edu/about"
## [4] "/advanced-search"
## [5] "https://www.ucsb.edu/"
## [6] "/documents"
## [7] "/documents/presidential-documents-archive-guidebook"
## [8] "/documents/category-attributes"
## [9] "/statistics"
## [10] "/media"
## [11] "/presidents"
## [12] "/analyses"
## [13] "https://giving.ucsb.edu/Funds/Give?id=185"
## [14] "https://www.presidency.ucsb.edu/how-to-search"
## [15] NA
## [16] "/advanced-search?field-keywords=crisis&items_per_page=25&field-keywords2=&field-keywords3=&from&to&person2=&&order=field_docs_start_date_time_value&sort=asc"
## [17] "/advanced-search?field-keywords=crisis&items_per_page=25&field-keywords2=&field-keywords3=&from&to&person2=&&order=field_docs_person&sort=asc"
## [18] "/people/president/george-washington"
## [19] "/documents/inaugural-address-16"
## [20] "/people/president/george-washington"
## [21] "/documents/message-reply-the-senate-10"
## [22] "/people/president/george-washington"
## [23] "/documents/special-message-3786"
## [24] "/people/president/george-washington"
## [25] "/documents/sixth-annual-address-congress"
## [26] "/people/president/george-washington"
## [27] "/documents/message-reply-the-house-representatives-0"
## [28] "/people/president/john-adams"
## [29] "/documents/inaugural-address-18"
## [30] "/people/president/john-adams"
## [31] "/documents/address-joint-session-congress-relations-with-france"
## [32] "/people/president/john-adams"
## [33] "/documents/message-reply-the-house-representatives-5"
## [34] "/people/president/john-adams"
## [35] "/documents/letter-john-adams-from-george-washington"
## [36] "/people/president/john-adams"
## [37] "/documents/message-reply-the-house-representatives-4"
## [38] "/people/president/john-adams"
## [39] "/documents/special-message-2941"
## [40] "/people/president/thomas-jefferson"
## [41] "/documents/inaugural-address-20"
## [42] "/people/president/thomas-jefferson"
## [43] "/documents/special-message-1828"
## [44] "/people/president/thomas-jefferson"
## [45] "/documents/proclamation-14-requiring-removal-british-armed-vessels-from-united-states-ports-and"
## [46] "/people/president/thomas-jefferson"
## [47] "/documents/special-message-2565"
## [48] "/people/president/thomas-jefferson"
## [49] "/documents/special-message-2561"
## [50] "/people/president/thomas-jefferson"
## [51] "/documents/special-message-2177"
## [52] "/people/president/thomas-jefferson"
## [53] "/documents/eighth-annual-message"
## [54] "/people/president/james-madison"
## [55] "/documents/proclamation-16-taking-possession-part-louisiana-annexation-west-florida"
## [56] "/people/president/james-madison"
## [57] "/documents/third-annual-message-0"
## [58] "/people/president/james-madison"
## [59] "/documents/special-message-887"
## [60] "/people/president/james-madison"
## [61] "/documents/message-the-senate-returning-without-approval-act-incorporate-the-subscribers-the-bank-the"
## [62] "/people/president/james-monroe"
## [63] "/documents/inaugural-address-23"
## [64] "/people/president/james-monroe"
## [65] "/documents/eighth-annual-message-1"
## [66] "/people/president/john-quincy-adams"
## [67] "/documents/executive-order"
## [68] "/advanced-search?field-keywords=crisis&items_per_page=25&page=1"
## [69] "/advanced-search?field-keywords=crisis&items_per_page=25&page=2"
## [70] "/advanced-search?field-keywords=crisis&items_per_page=25&page=3"
## [71] "/advanced-search?field-keywords=crisis&items_per_page=25&page=4"
## [72] "/advanced-search?field-keywords=crisis&items_per_page=25&page=5"
## [73] "/advanced-search?field-keywords=crisis&items_per_page=25&page=6"
## [74] "/advanced-search?field-keywords=crisis&items_per_page=25&page=7"
## [75] "/advanced-search?field-keywords=crisis&items_per_page=25&page=8"
## [76] "/advanced-search?field-keywords=crisis&items_per_page=25&page=1"
## [77] "/advanced-search?field-keywords=crisis&items_per_page=25&page=522"
## [78] "https://www.presidency.ucsb.edu/contact"
## [79] "https://twitter.com/presidency_proj"
## [80] "https://www.facebook.com/pg/american.presidency.project/"
## [81] "http://www.ucsb.edu/terms-of-use"
## [82] "http://www.policy.ucsb.edu/privacy-notification/"
## [83] "/accessibility"
searchresults %>% html_elements(".views-field-title a") %>% html_attr("href")
## [1] "/documents/inaugural-address-16"
## [2] "/documents/message-reply-the-senate-10"
## [3] "/documents/special-message-3786"
## [4] "/documents/sixth-annual-address-congress"
## [5] "/documents/message-reply-the-house-representatives-0"
## [6] "/documents/inaugural-address-18"
## [7] "/documents/address-joint-session-congress-relations-with-france"
## [8] "/documents/message-reply-the-house-representatives-5"
## [9] "/documents/letter-john-adams-from-george-washington"
## [10] "/documents/message-reply-the-house-representatives-4"
## [11] "/documents/special-message-2941"
## [12] "/documents/inaugural-address-20"
## [13] "/documents/special-message-1828"
## [14] "/documents/proclamation-14-requiring-removal-british-armed-vessels-from-united-states-ports-and"
## [15] "/documents/special-message-2565"
## [16] "/documents/special-message-2561"
## [17] "/documents/special-message-2177"
## [18] "/documents/eighth-annual-message"
## [19] "/documents/proclamation-16-taking-possession-part-louisiana-annexation-west-florida"
## [20] "/documents/third-annual-message-0"
## [21] "/documents/special-message-887"
## [22] "/documents/message-the-senate-returning-without-approval-act-incorporate-the-subscribers-the-bank-the"
## [23] "/documents/inaugural-address-23"
## [24] "/documents/eighth-annual-message-1"
## [25] "/documents/executive-order"
Do you notice something about the links? They are missing a part. That is because they are relative links within the directory structure of the webpage. To ‘repair’ them, we need to add the base url of the webpage. This is typically just the url of the webpage we originally scraped from.
For adding the base url, we can use the function paste()
that pastes together two character vectors. I recommend using paste0()
which pastes the vectors together without inserting separators like white space between the vectors. If you have never used paste, try it out:
paste("a","b")
## [1] "a b"
paste0("a","b")
## [1] "ab"
Now, completing the paths of the URLs we scraped should not be a problem for you. Re-use the code you used to extract the links of the tags, assign it to an object called url
and add the base url (https://www.presidency.ucsb.edu) in front of it.
Watch out for the slashes between the base url and the address of your page - having none or too many slashes is a typical problem!
urls <- searchresults %>% html_elements(".views-field-title a") %>% html_attr("href")
urls <- paste0("https://www.presidency.ucsb.edu",urls)
Now, we will learn how to follow multiple links and automate this process in different ways.
You will see that in the end, webscraping is a function of programming in R. The more you learn to use loops, functions and apply commands, the easier the scraping will be. In the end, scraping is just a small step in the whole process of getting data.
So far, we already learned to collect all the links we are interested in and learned the basic commands of rvest. Now, there are multiple ways to proceed:
for()
-loop that loops over the vector of links and scrapes each of themapply()
the function to a vector - this is the fastest variant but takes some getting used toFor today, we will start with the easiest variant and just create a for
-loop. Later, we will also use apply()
but there are good reasons why you will often return to simple loops.
We again start by scraping the results of your query. I recommend to first write down a few lines of code as if you would just want to scrape the first link:
This is also a good exercise to see to which extent you remember what we have learned so far. You can then think about re-writing the code in the next step.
searchresults <- read_html("https://www.presidency.ucsb.edu/advanced-search?field-keywords=crisis&items_per_page=25")
urls <- searchresults %>% html_elements(".views-field-title a") %>% html_attr("href")
urls <- paste0("https://www.presidency.ucsb.edu",urls)
speechtext <- read_html(urls[1]) %>%
html_elements(".field-docs-content") %>%
html_text()
Now, we to analyze the code: which part will vary when you try to repeat this multiple times? If you have figured this out, it is time to try it!
text <- ""
for (i in 1:25){
text[i] <- read_html(urls[i]) %>%
html_elements(".field-docs-content") %>%
html_text()
}
So far, we are still rather limited in our data collection: We have just collected the speeches from the first page.
Now, we write a loop that runs through all pages and collects
It would be tedious to extract the links to all further pages - especially because not all of them are listed on the first page. Instead, we need to find a logic behind the sequence of pages. Click through the first few pages of results - what changes about the url as you do so?
While we are looking at the URL: Generally, we try to collect as much data per page as possible. Do you find where the URL says the number of results per pages? Change the URL to include a higher number and copy-paste your code to scrape the table and the links - do you find more links or do you need to adapt more?
url <- "https://www.presidency.ucsb.edu/advanced-search?field-keywords=crisis&items_per_page=100"
searchresults <- read_html(url)
resultstable <- html_table(searchresults)
urls <- searchresults %>% html_elements(".views-field-title a") %>% html_attr("href")
urls <- paste0("https://www.presidency.ucsb.edu",urls)
To do this not for a fixed number of pages but all pages, we need to find out the number of results pages. We can simply do this by returning to the page and checking what is the number of the last page.
Or, we try to automate this by extracting the link to the last page using SelectorGadget. We can then use regular expressions to automatically extract the number of the last page. I’ve pre-written this, given we do not cover Regular Expressions in this course but you can check this Cheat Sheet if you want:
Regular Expressions Cheat sheet
Advice: Try to set the number of results per page as high as you can to reduce the number of pages you have to visit. We do this here by setting the items per page to 100.
# replace with your URL
url<-"https://www.presidency.ucsb.edu/advanced-search?field-keywords=crisis&items_per_page=100"
searchresults<-read_html(url)
# choose last page of search results
last_page<-html_elements(searchresults,".pager-last a") %>% html_attr("href")
library(stringr)
last_page <- str_extract(last_page,"[0-9]*$")
last_page <- as.numeric(last_page)
Now, try to create the URLs for all pages. A hint: you can often also reach the first page by specifying page=0
(in this case) or page=1
(in those cases where the second page has an address that includes the number 2).
resulturls <- paste0("https://www.presidency.ucsb.edu/advanced-search?field-keywords=crisis&items_per_page=100&page=", 0:last_page)
Now, we can write a loop that goes through all pages and collects the results tables and links.
For this, we need to create empty objects for the tables and URLs we want to collect. We can either progressively bind the tables together each time we loop through the code or store them in a list and combine them afterwards - i have pre-written code for both.
# OPTION 1: we merge the tables and URLs inside the loop
tables<-NULL
URLs<-NULL
for (i in 1:length(resulturls)) {
page<-read_html(resulturls[i])
tables<-bind_rows(tables,
html_table(page))
URLs<-c(URLs,
html_elements(page,".views-field-title a") %>%
html_attr("href"))
}
tables$URL<-URLs
# OPTION 2: we put them in a list and afterwards extract and merge them
empty_list<- list()
empty_list2 <- list()
for (i in 1:length(resulturls)){
page<-read_html(paste0(base,i))
empty_list[[i]]<-html_table(page) %>% extract2(1)
empty_list2[[i]]<-html_elements(page,".views-field-title a") %>%
html_attr("href")
}
full_table <- do.call("rbind",empty_list)
all_links <- unlist(empty_list2)
Based on this, you’re ready to collect the text of all speeches!
You can try this with two levels of difficulty:
If you prefer to repeat what we’ve done to make sure you’ve understood each part, open a new R file and try to write the scraper from scratch! 05_singlefile.rmd
If you think you can adapt this to a new webpage, write a similar scraper for White House Briefing Statements or a similar page you want to scrape. 05_scraping_briefings.rmd
(And if you want to adapt this to download pdf files - as some of you suggest, I uploaded another example script that I’ve used for European Central Bank Texts in a different class: example_imf.rmd )