mirror of
https://github.com/kidwellj/hacking_religion_textbook.git
synced 2025-06-15 16:54:10 +00:00
updated chapters
This commit is contained in:
parent
f8735b6edf
commit
3a657d6b2f
8 changed files with 217 additions and 269 deletions
|
@ -249,142 +249,114 @@ div.csl-indent {
|
|||
<div class="cell">
|
||||
<div class="sourceCode cell-code" id="cb1"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb1-1"><a href="#cb1-1" aria-hidden="true" tabindex="-1"></a><span class="fu">library</span>(sf) <span class="sc">|></span> <span class="fu">suppressPackageStartupMessages</span>()</span>
|
||||
<span id="cb1-2"><a href="#cb1-2" aria-hidden="true" tabindex="-1"></a><span class="fu">library</span>(here) <span class="sc">|></span> <span class="fu">suppressPackageStartupMessages</span>()</span>
|
||||
<span id="cb1-3"><a href="#cb1-3" aria-hidden="true" tabindex="-1"></a><span class="fu">library</span>(tidyverse) <span class="sc">|></span> <span class="fu">suppressPackageStartupMessages</span>()</span>
|
||||
<span id="cb1-4"><a href="#cb1-4" aria-hidden="true" tabindex="-1"></a><span class="fu">setwd</span>(<span class="st">"/Users/kidwellj/gits/hacking_religion_textbook/hacking_religion"</span>)</span>
|
||||
<span id="cb1-5"><a href="#cb1-5" aria-hidden="true" tabindex="-1"></a>here<span class="sc">::</span><span class="fu">i_am</span>(<span class="st">"chapter_3.qmd"</span>)</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
|
||||
<span id="cb1-3"><a href="#cb1-3" aria-hidden="true" tabindex="-1"></a><span class="fu">library</span>(tidyverse) </span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
|
||||
<div class="cell-output cell-output-stderr">
|
||||
<pre><code>-- Attaching core tidyverse packages ------------------------ tidyverse 2.0.0 --
|
||||
v dplyr 1.1.3 v readr 2.1.4
|
||||
v forcats 1.0.0 v stringr 1.5.0
|
||||
v ggplot2 3.4.3 v tibble 3.2.1
|
||||
v lubridate 1.9.3 v tidyr 1.3.0
|
||||
v purrr 1.0.2
|
||||
-- Conflicts ------------------------------------------ tidyverse_conflicts() --
|
||||
x dplyr::filter() masks stats::filter()
|
||||
x dplyr::lag() masks stats::lag()
|
||||
i Use the conflicted package (<http://conflicted.r-lib.org/>) to force all conflicts to become errors</code></pre>
|
||||
</div>
|
||||
<div class="sourceCode cell-code" id="cb3"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb3-1"><a href="#cb3-1" aria-hidden="true" tabindex="-1"></a><span class="co"># better video device, more accurate and faster rendering, esp. on macos. Also should enable system fonts for display</span></span>
|
||||
<span id="cb3-2"><a href="#cb3-2" aria-hidden="true" tabindex="-1"></a><span class="fu">library</span>(ragg) <span class="sc">|></span> <span class="fu">suppressPackageStartupMessages</span>()</span>
|
||||
<span id="cb3-3"><a href="#cb3-3" aria-hidden="true" tabindex="-1"></a></span>
|
||||
<span id="cb3-4"><a href="#cb3-4" aria-hidden="true" tabindex="-1"></a><span class="fu">setwd</span>(<span class="st">"/Users/kidwellj/gits/hacking_religion_textbook/hacking_religion"</span>)</span>
|
||||
<span id="cb3-5"><a href="#cb3-5" aria-hidden="true" tabindex="-1"></a>here<span class="sc">::</span><span class="fu">i_am</span>(<span class="st">"chapter_3.qmd"</span>)</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
|
||||
<div class="cell-output cell-output-stderr">
|
||||
<pre><code>here() starts at /Users/kidwellj/gits/hacking_religion_textbook/hacking_religion</code></pre>
|
||||
</div>
|
||||
<div class="sourceCode cell-code" id="cb3"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb3-1"><a href="#cb3-1" aria-hidden="true" tabindex="-1"></a><span class="co"># Download administrative boundaries for whole UK at country level</span></span>
|
||||
<span id="cb3-2"><a href="#cb3-2" aria-hidden="true" tabindex="-1"></a><span class="cf">if</span> (<span class="fu">file.exists</span>(<span class="fu">here</span>(<span class="st">"data"</span>, <span class="st">"infuse_uk_2011_clipped.shp"</span>)) <span class="sc">==</span> <span class="cn">FALSE</span>) {</span>
|
||||
<span id="cb3-3"><a href="#cb3-3" aria-hidden="true" tabindex="-1"></a><span class="fu">download.file</span>(<span class="st">"https://borders.ukdataservice.ac.uk/ukborders/easy_download/prebuilt/shape/infuse_uk_2011_clipped.zip"</span>, <span class="at">destfile =</span> <span class="st">"data/infuse_uk_2011_clipped.zip"</span>)</span>
|
||||
<span id="cb3-4"><a href="#cb3-4" aria-hidden="true" tabindex="-1"></a><span class="fu">unzip</span>(<span class="st">"data/infuse_uk_2011_clipped.zip"</span>, <span class="at">exdir =</span> <span class="st">"data"</span>)</span>
|
||||
<span id="cb3-5"><a href="#cb3-5" aria-hidden="true" tabindex="-1"></a>}</span>
|
||||
<span id="cb3-6"><a href="#cb3-6" aria-hidden="true" tabindex="-1"></a>uk_countries <span class="ot"><-</span> <span class="fu">st_read</span>(<span class="fu">here</span>(<span class="st">"data"</span>, <span class="st">"infuse_uk_2011_clipped.shp"</span>))</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
|
||||
<div class="cell-output cell-output-stdout">
|
||||
<pre><code>Reading layer `infuse_uk_2011_clipped' from data source
|
||||
`/Users/kidwellj/gits/hacking_religion_textbook/hacking_religion/data/infuse_uk_2011_clipped.shp'
|
||||
using driver `ESRI Shapefile'
|
||||
Simple feature collection with 1 feature and 3 fields
|
||||
Geometry type: MULTIPOLYGON
|
||||
Dimension: XY
|
||||
Bounding box: xmin: -69.1254 ymin: 5337.9 xmax: 655604.7 ymax: 1220302
|
||||
Projected CRS: OSGB36 / British National Grid</code></pre>
|
||||
</div>
|
||||
<div class="sourceCode cell-code" id="cb5"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb5-1"><a href="#cb5-1" aria-hidden="true" tabindex="-1"></a><span class="co"># Download administrative boundaries for whole UK at regions level</span></span>
|
||||
<span id="cb5-2"><a href="#cb5-2" aria-hidden="true" tabindex="-1"></a><span class="cf">if</span> (<span class="fu">file.exists</span>(<span class="fu">here</span>(<span class="st">"data"</span>, <span class="st">"infuse_rgn_2011_clipped.shp"</span>)) <span class="sc">==</span> <span class="cn">FALSE</span>) {</span>
|
||||
<span id="cb5-3"><a href="#cb5-3" aria-hidden="true" tabindex="-1"></a><span class="fu">download.file</span>(<span class="st">"https://borders.ukdataservice.ac.uk/ukborders/easy_download/prebuilt/shape/infuse_rgn_2011_clipped.zip"</span>, <span class="at">destfile =</span> <span class="st">"data/infuse_rgn_2011_clipped.zip"</span>)</span>
|
||||
<span id="cb5-4"><a href="#cb5-4" aria-hidden="true" tabindex="-1"></a><span class="fu">unzip</span>(<span class="st">"data/infuse_rgn_2011_clipped.zip"</span>, <span class="at">exdir =</span> <span class="st">"data"</span>)</span>
|
||||
<div class="sourceCode cell-code" id="cb5"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb5-1"><a href="#cb5-1" aria-hidden="true" tabindex="-1"></a><span class="co"># Download administrative boundaries for whole UK at country level</span></span>
|
||||
<span id="cb5-2"><a href="#cb5-2" aria-hidden="true" tabindex="-1"></a><span class="cf">if</span> (<span class="fu">file.exists</span>(<span class="fu">here</span>(<span class="st">"data"</span>, <span class="st">"infuse_uk_2011_clipped.shp"</span>)) <span class="sc">==</span> <span class="cn">FALSE</span>) {</span>
|
||||
<span id="cb5-3"><a href="#cb5-3" aria-hidden="true" tabindex="-1"></a><span class="fu">download.file</span>(<span class="st">"https://borders.ukdataservice.ac.uk/ukborders/easy_download/prebuilt/shape/infuse_uk_2011_clipped.zip"</span>, <span class="at">destfile =</span> <span class="st">"data/infuse_uk_2011_clipped.zip"</span>)</span>
|
||||
<span id="cb5-4"><a href="#cb5-4" aria-hidden="true" tabindex="-1"></a><span class="fu">unzip</span>(<span class="st">"data/infuse_uk_2011_clipped.zip"</span>, <span class="at">exdir =</span> <span class="st">"data"</span>)</span>
|
||||
<span id="cb5-5"><a href="#cb5-5" aria-hidden="true" tabindex="-1"></a>}</span>
|
||||
<span id="cb5-6"><a href="#cb5-6" aria-hidden="true" tabindex="-1"></a>uk_rgn <span class="ot"><-</span> <span class="fu">st_read</span>(<span class="fu">here</span>(<span class="st">"data"</span>, <span class="st">"infuse_rgn_2011_clipped.shp"</span>))</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
|
||||
<div class="cell-output cell-output-stdout">
|
||||
<pre><code>Reading layer `infuse_rgn_2011_clipped' from data source
|
||||
`/Users/kidwellj/gits/hacking_religion_textbook/hacking_religion/data/infuse_rgn_2011_clipped.shp'
|
||||
using driver `ESRI Shapefile'
|
||||
Simple feature collection with 9 features and 2 fields
|
||||
Geometry type: MULTIPOLYGON
|
||||
Dimension: XY
|
||||
Bounding box: xmin: 82672 ymin: 5337.9 xmax: 655604.7 ymax: 657534.1
|
||||
Projected CRS: OSGB36 / British National Grid</code></pre>
|
||||
</div>
|
||||
<div class="sourceCode cell-code" id="cb7"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb7-1"><a href="#cb7-1" aria-hidden="true" tabindex="-1"></a><span class="co"># Download administrative boundaries for whole UK at local authority level</span></span>
|
||||
<span id="cb7-2"><a href="#cb7-2" aria-hidden="true" tabindex="-1"></a><span class="cf">if</span> (<span class="fu">file.exists</span>(<span class="fu">here</span>(<span class="st">"data"</span>, <span class="st">"infuse_dist_lyr_2011_clipped.shp"</span>)) <span class="sc">==</span> <span class="cn">FALSE</span>) {</span>
|
||||
<span id="cb7-3"><a href="#cb7-3" aria-hidden="true" tabindex="-1"></a><span class="fu">download.file</span>(<span class="st">"https://borders.ukdataservice.ac.uk/ukborders/easy_download/prebuilt/shape/infuse_dist_lyr_2011_clipped.zip"</span>, <span class="at">destfile =</span> <span class="st">"data/infuse_dist_lyr_2011_clipped.zip"</span>)</span>
|
||||
<span id="cb7-4"><a href="#cb7-4" aria-hidden="true" tabindex="-1"></a><span class="fu">unzip</span>(<span class="st">"data/infuse_dist_lyr_2011_clipped.zip"</span>, <span class="at">exdir =</span> <span class="st">"data"</span>)</span>
|
||||
<span id="cb7-5"><a href="#cb7-5" aria-hidden="true" tabindex="-1"></a>}</span>
|
||||
<span id="cb7-6"><a href="#cb7-6" aria-hidden="true" tabindex="-1"></a>local_authorities <span class="ot"><-</span> <span class="fu">st_read</span>(<span class="fu">here</span>(<span class="st">"data"</span>, <span class="st">"infuse_dist_lyr_2011_clipped.shp"</span>))</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
|
||||
<div class="cell-output cell-output-stdout">
|
||||
<pre><code>Reading layer `infuse_dist_lyr_2011_clipped' from data source
|
||||
`/Users/kidwellj/gits/hacking_religion_textbook/hacking_religion/data/infuse_dist_lyr_2011_clipped.shp'
|
||||
using driver `ESRI Shapefile'
|
||||
Simple feature collection with 404 features and 3 fields
|
||||
Geometry type: MULTIPOLYGON
|
||||
Dimension: XY
|
||||
Bounding box: xmin: -69.1254 ymin: 5337.9 xmax: 655604.7 ymax: 1220302
|
||||
Projected CRS: OSGB36 / British National Grid</code></pre>
|
||||
</div>
|
||||
<div class="sourceCode cell-code" id="cb9"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb9-1"><a href="#cb9-1" aria-hidden="true" tabindex="-1"></a><span class="co"># Download building outlines for whole UK</span></span>
|
||||
<span id="cb9-2"><a href="#cb9-2" aria-hidden="true" tabindex="-1"></a><span class="cf">if</span> (<span class="fu">file.exists</span>(<span class="fu">here</span>(<span class="st">"data"</span>, <span class="st">"infuse_dist_lyr_2011_simplified_100m_buildings_simplified.gpkg"</span>)) <span class="sc">==</span> <span class="cn">FALSE</span>) {</span>
|
||||
<span id="cb9-3"><a href="#cb9-3" aria-hidden="true" tabindex="-1"></a> <span class="fu">download.file</span>(<span class="st">"https://zenodo.org/record/6395804/files/infuse_dist_lyr_2011_simplified_100m_buildings_overlay_simplified.gpkg"</span>, <span class="at">destfile =</span> <span class="fu">here</span>(<span class="st">"data"</span>, <span class="st">"infuse_dist_lyr_2011_simplified_100m_buildings_simplified.gpkg"</span>))}</span>
|
||||
<span id="cb9-4"><a href="#cb9-4" aria-hidden="true" tabindex="-1"></a>local_authorities_buildings_clip <span class="ot"><-</span> <span class="fu">st_read</span>(<span class="fu">here</span>(<span class="st">"data"</span>, <span class="st">"infuse_dist_lyr_2011_simplified_100m_buildings_simplified.gpkg"</span>))</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
|
||||
<div class="cell-output cell-output-stdout">
|
||||
<pre><code>Reading layer `infuse_dist_lyr_2011_simplified_100_buildings_overlay_simplified' from data source `/Users/kidwellj/gits/hacking_religion_textbook/hacking_religion/data/infuse_dist_lyr_2011_simplified_100m_buildings_simplified.gpkg'
|
||||
using driver `GPKG'
|
||||
Simple feature collection with 403 features and 0 fields
|
||||
Geometry type: MULTIPOLYGON
|
||||
Dimension: XY
|
||||
Bounding box: xmin: -69.1254 ymin: 5524.797 xmax: 655986.4 ymax: 1219597
|
||||
Projected CRS: OSGB36 / British National Grid</code></pre>
|
||||
</div>
|
||||
<span id="cb5-6"><a href="#cb5-6" aria-hidden="true" tabindex="-1"></a>uk_countries <span class="ot"><-</span> <span class="fu">st_read</span>(<span class="fu">here</span>(<span class="st">"data"</span>, <span class="st">"infuse_uk_2011_clipped.shp"</span>), <span class="at">quiet =</span> <span class="cn">TRUE</span>)</span>
|
||||
<span id="cb5-7"><a href="#cb5-7" aria-hidden="true" tabindex="-1"></a></span>
|
||||
<span id="cb5-8"><a href="#cb5-8" aria-hidden="true" tabindex="-1"></a><span class="co"># Download administrative boundaries for whole UK at regions level</span></span>
|
||||
<span id="cb5-9"><a href="#cb5-9" aria-hidden="true" tabindex="-1"></a><span class="cf">if</span> (<span class="fu">file.exists</span>(<span class="fu">here</span>(<span class="st">"data"</span>, <span class="st">"infuse_rgn_2011_clipped.shp"</span>)) <span class="sc">==</span> <span class="cn">FALSE</span>) {</span>
|
||||
<span id="cb5-10"><a href="#cb5-10" aria-hidden="true" tabindex="-1"></a><span class="fu">download.file</span>(<span class="st">"https://borders.ukdataservice.ac.uk/ukborders/easy_download/prebuilt/shape/infuse_rgn_2011_clipped.zip"</span>, <span class="at">destfile =</span> <span class="st">"data/infuse_rgn_2011_clipped.zip"</span>)</span>
|
||||
<span id="cb5-11"><a href="#cb5-11" aria-hidden="true" tabindex="-1"></a><span class="fu">unzip</span>(<span class="st">"data/infuse_rgn_2011_clipped.zip"</span>, <span class="at">exdir =</span> <span class="st">"data"</span>)</span>
|
||||
<span id="cb5-12"><a href="#cb5-12" aria-hidden="true" tabindex="-1"></a>}</span>
|
||||
<span id="cb5-13"><a href="#cb5-13" aria-hidden="true" tabindex="-1"></a>uk_rgn <span class="ot"><-</span> <span class="fu">st_read</span>(<span class="fu">here</span>(<span class="st">"data"</span>, <span class="st">"infuse_rgn_2011_clipped.shp"</span>), <span class="at">quiet =</span> <span class="cn">TRUE</span>)</span>
|
||||
<span id="cb5-14"><a href="#cb5-14" aria-hidden="true" tabindex="-1"></a></span>
|
||||
<span id="cb5-15"><a href="#cb5-15" aria-hidden="true" tabindex="-1"></a><span class="co"># Download administrative boundaries for whole UK at local authority level</span></span>
|
||||
<span id="cb5-16"><a href="#cb5-16" aria-hidden="true" tabindex="-1"></a><span class="cf">if</span> (<span class="fu">file.exists</span>(<span class="fu">here</span>(<span class="st">"data"</span>, <span class="st">"infuse_dist_lyr_2011_clipped.shp"</span>)) <span class="sc">==</span> <span class="cn">FALSE</span>) {</span>
|
||||
<span id="cb5-17"><a href="#cb5-17" aria-hidden="true" tabindex="-1"></a><span class="fu">download.file</span>(<span class="st">"https://borders.ukdataservice.ac.uk/ukborders/easy_download/prebuilt/shape/infuse_dist_lyr_2011_clipped.zip"</span>, <span class="at">destfile =</span> <span class="st">"data/infuse_dist_lyr_2011_clipped.zip"</span>)</span>
|
||||
<span id="cb5-18"><a href="#cb5-18" aria-hidden="true" tabindex="-1"></a><span class="fu">unzip</span>(<span class="st">"data/infuse_dist_lyr_2011_clipped.zip"</span>, <span class="at">exdir =</span> <span class="st">"data"</span>)</span>
|
||||
<span id="cb5-19"><a href="#cb5-19" aria-hidden="true" tabindex="-1"></a>}</span>
|
||||
<span id="cb5-20"><a href="#cb5-20" aria-hidden="true" tabindex="-1"></a>local_authorities <span class="ot"><-</span> <span class="fu">st_read</span>(<span class="fu">here</span>(<span class="st">"data"</span>, <span class="st">"infuse_dist_lyr_2011_clipped.shp"</span>), <span class="at">quiet =</span> <span class="cn">TRUE</span>)</span>
|
||||
<span id="cb5-21"><a href="#cb5-21" aria-hidden="true" tabindex="-1"></a></span>
|
||||
<span id="cb5-22"><a href="#cb5-22" aria-hidden="true" tabindex="-1"></a><span class="co"># Download building outlines for whole UK</span></span>
|
||||
<span id="cb5-23"><a href="#cb5-23" aria-hidden="true" tabindex="-1"></a><span class="cf">if</span> (<span class="fu">file.exists</span>(<span class="fu">here</span>(<span class="st">"data"</span>, <span class="st">"infuse_dist_lyr_2011_simplified_100m_buildings_simplified.gpkg"</span>)) <span class="sc">==</span> <span class="cn">FALSE</span>) {</span>
|
||||
<span id="cb5-24"><a href="#cb5-24" aria-hidden="true" tabindex="-1"></a> <span class="fu">download.file</span>(<span class="st">"https://zenodo.org/record/6395804/files/infuse_dist_lyr_2011_simplified_100m_buildings_overlay_simplified.gpkg"</span>, <span class="at">destfile =</span> <span class="fu">here</span>(<span class="st">"data"</span>, <span class="st">"infuse_dist_lyr_2011_simplified_100m_buildings_simplified.gpkg"</span>))}</span>
|
||||
<span id="cb5-25"><a href="#cb5-25" aria-hidden="true" tabindex="-1"></a>local_authorities_buildings_clip <span class="ot"><-</span> <span class="fu">st_read</span>(<span class="fu">here</span>(<span class="st">"data"</span>, <span class="st">"infuse_dist_lyr_2011_simplified_100m_buildings_simplified.gpkg"</span>), <span class="at">quiet =</span> <span class="cn">TRUE</span>)</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
|
||||
</div>
|
||||
<p>Before we move on, let’s plot a simple map and have a look at one of our administrative layers. We can use ggplot with a new type of shape <code>geom_sf()</code> to plot the contents of a geospatial data file with polygons which is loaded as a <code>simplefeature</code> in R.</p>
|
||||
<div class="cell">
|
||||
<div class="sourceCode cell-code" id="cb11"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb11-1"><a href="#cb11-1" aria-hidden="true" tabindex="-1"></a><span class="fu">ggplot</span>(uk_countries) <span class="sc">+</span></span>
|
||||
<span id="cb11-2"><a href="#cb11-2" aria-hidden="true" tabindex="-1"></a> <span class="fu">geom_sf</span>()</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
|
||||
<div class="cell-output-display">
|
||||
<p><img src="chapter_3_files/figure-html/unnamed-chunk-2-1.png" class="img-fluid" width="672"></p>
|
||||
<div class="sourceCode cell-code" id="cb6"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb6-1"><a href="#cb6-1" aria-hidden="true" tabindex="-1"></a><span class="fu">library</span>(bench) <span class="sc">|></span> <span class="fu">suppressPackageStartupMessages</span>()</span>
|
||||
<span id="cb6-2"><a href="#cb6-2" aria-hidden="true" tabindex="-1"></a><span class="fu">bench_time</span>(<span class="fu">ggplot</span>(uk_countries) <span class="sc">+</span> <span class="fu">geom_sf</span>())</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
|
||||
<div class="cell-output cell-output-stdout">
|
||||
<pre><code>process real
|
||||
6.83ms 7.05ms </code></pre>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
<section id="load-in-ordnance-survey-openmap-points-data" class="level1" data-number="6">
|
||||
<h1 data-number="6"><span class="header-section-number">6</span> Load in Ordnance Survey OpenMap Points Data</h1>
|
||||
<div class="cell">
|
||||
<div class="sourceCode cell-code" id="cb12"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb12-1"><a href="#cb12-1" aria-hidden="true" tabindex="-1"></a><span class="co"># Note: for more advanced reproducible scripts which demonstrate how these data surces have been </span></span>
|
||||
<span id="cb12-2"><a href="#cb12-2" aria-hidden="true" tabindex="-1"></a><span class="co"># obtained, see the companion cookbook here: https://github.com/kidwellj/hacking_religion_cookbook/blob/main/ordnance_survey.R</span></span>
|
||||
<span id="cb12-3"><a href="#cb12-3" aria-hidden="true" tabindex="-1"></a></span>
|
||||
<span id="cb12-4"><a href="#cb12-4" aria-hidden="true" tabindex="-1"></a>os_openmap_pow <span class="ot"><-</span> <span class="fu">st_read</span>(<span class="fu">here</span>(<span class="st">"data"</span>, <span class="st">"os_openmap_pow.gpkg"</span>))</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
|
||||
<div class="sourceCode cell-code" id="cb8"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb8-1"><a href="#cb8-1" aria-hidden="true" tabindex="-1"></a><span class="co"># Note: for more advanced reproducible scripts which demonstrate how these data surces have been </span></span>
|
||||
<span id="cb8-2"><a href="#cb8-2" aria-hidden="true" tabindex="-1"></a><span class="co"># obtained, see the companion cookbook here: https://github.com/kidwellj/hacking_religion_cookbook/blob/main/ordnance_survey.R</span></span>
|
||||
<span id="cb8-3"><a href="#cb8-3" aria-hidden="true" tabindex="-1"></a></span>
|
||||
<span id="cb8-4"><a href="#cb8-4" aria-hidden="true" tabindex="-1"></a>os_openmap_pow <span class="ot"><-</span> <span class="fu">st_read</span>(<span class="fu">here</span>(<span class="st">"data"</span>, <span class="st">"os_openmap_pow.gpkg"</span>), <span class="at">quiet =</span> <span class="cn">TRUE</span>)</span>
|
||||
<span id="cb8-5"><a href="#cb8-5" aria-hidden="true" tabindex="-1"></a></span>
|
||||
<span id="cb8-6"><a href="#cb8-6" aria-hidden="true" tabindex="-1"></a><span class="fu">bench_time</span>(<span class="fu">ggplot</span>(os_openmap_pow) <span class="sc">+</span> <span class="fu">geom_sf</span>())</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
|
||||
<div class="cell-output cell-output-stdout">
|
||||
<pre><code>Reading layer `os_openmap_pow' from data source
|
||||
`/Users/kidwellj/gits/hacking_religion_textbook/hacking_religion/data/os_openmap_pow.gpkg'
|
||||
using driver `GPKG'
|
||||
Simple feature collection with 48759 features and 5 fields
|
||||
Geometry type: POLYGON
|
||||
Dimension: XY
|
||||
Bounding box: xmin: 64594.12 ymin: 8287.54 xmax: 655238.1 ymax: 1214662
|
||||
Projected CRS: OSGB36 / British National Grid</code></pre>
|
||||
</div>
|
||||
<div class="sourceCode cell-code" id="cb14"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb14-1"><a href="#cb14-1" aria-hidden="true" tabindex="-1"></a><span class="fu">ggplot</span>(os_openmap_pow) <span class="sc">+</span></span>
|
||||
<span id="cb14-2"><a href="#cb14-2" aria-hidden="true" tabindex="-1"></a> <span class="fu">geom_sf</span>()</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
|
||||
<div class="cell-output-display">
|
||||
<p><img src="chapter_3_files/figure-html/unnamed-chunk-3-1.png" class="img-fluid" width="672"></p>
|
||||
<pre><code>process real
|
||||
1.17ms 1.15ms </code></pre>
|
||||
</div>
|
||||
</div>
|
||||
<p>It’s worth noting that the way that you load geospatial data in R has changed quite dramatically since 2020 with the introduction of the simplefeature class in R. Much of the documentation you will come across “out there” will make reference to a set of functions which are now deprecated.</p>
|
||||
<p>Let’s use that data we’ve just loaded to make our first map:</p>
|
||||
<div class="cell">
|
||||
<div class="sourceCode cell-code" id="cb15"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb15-1"><a href="#cb15-1" aria-hidden="true" tabindex="-1"></a><span class="co"># Generate choropleth map of respondent locations</span></span>
|
||||
<span id="cb15-2"><a href="#cb15-2" aria-hidden="true" tabindex="-1"></a><span class="co"># using temporary palette here so that 0s are white</span></span>
|
||||
<span id="cb15-3"><a href="#cb15-3" aria-hidden="true" tabindex="-1"></a><span class="fu">library</span>(tmap) <span class="sc">|></span> <span class="fu">suppressPackageStartupMessages</span>()</span>
|
||||
<span id="cb15-4"><a href="#cb15-4" aria-hidden="true" tabindex="-1"></a><span class="co"># palette <- c(white, "#a8ddb5", "#43a2ca")</span></span>
|
||||
<span id="cb15-5"><a href="#cb15-5" aria-hidden="true" tabindex="-1"></a>map1 <span class="ot"><-</span> <span class="fu">tm_shape</span>(local_authorities) <span class="sc">+</span> </span>
|
||||
<span id="cb15-6"><a href="#cb15-6" aria-hidden="true" tabindex="-1"></a><span class="co"># tm_fill(col = "surveys_count", , palette = palette, title = "Concentration of survey respondents") +</span></span>
|
||||
<span id="cb15-7"><a href="#cb15-7" aria-hidden="true" tabindex="-1"></a> <span class="fu">tm_borders</span>(<span class="at">alpha=</span>.<span class="dv">5</span>, <span class="at">lwd=</span><span class="fl">0.1</span>) <span class="sc">+</span></span>
|
||||
<span id="cb15-8"><a href="#cb15-8" aria-hidden="true" tabindex="-1"></a> <span class="co"># for intermediate polygon geometries</span></span>
|
||||
<span id="cb15-9"><a href="#cb15-9" aria-hidden="true" tabindex="-1"></a> <span class="co"># tm_shape(local_authorities) +</span></span>
|
||||
<span id="cb15-10"><a href="#cb15-10" aria-hidden="true" tabindex="-1"></a> <span class="co"># tm_borders(lwd=0.6) +</span></span>
|
||||
<span id="cb15-11"><a href="#cb15-11" aria-hidden="true" tabindex="-1"></a> <span class="co"># for dots from original dataset</span></span>
|
||||
<span id="cb15-12"><a href="#cb15-12" aria-hidden="true" tabindex="-1"></a> <span class="co"># tm_dots("red", size = .05, alpha = .4) +</span></span>
|
||||
<span id="cb15-13"><a href="#cb15-13" aria-hidden="true" tabindex="-1"></a> <span class="fu">tm_scale_bar</span>(<span class="at">position =</span> <span class="fu">c</span>(<span class="st">"right"</span>, <span class="st">"bottom"</span>)) <span class="sc">+</span></span>
|
||||
<span id="cb15-14"><a href="#cb15-14" aria-hidden="true" tabindex="-1"></a> <span class="fu">tm_style</span>(<span class="st">"gray"</span>) <span class="sc">+</span></span>
|
||||
<span id="cb15-15"><a href="#cb15-15" aria-hidden="true" tabindex="-1"></a> <span class="fu">tm_credits</span>(<span class="st">"Data: UK Data Service (OGL)</span><span class="sc">\n</span><span class="st">& Jeremy H. Kidwell,</span><span class="sc">\n</span><span class="st">Graphic is CC-by-SA 4.0"</span>, </span>
|
||||
<span id="cb15-16"><a href="#cb15-16" aria-hidden="true" tabindex="-1"></a> <span class="at">size =</span> <span class="fl">0.4</span>, </span>
|
||||
<span id="cb15-17"><a href="#cb15-17" aria-hidden="true" tabindex="-1"></a> <span class="at">position =</span> <span class="fu">c</span>(<span class="st">"left"</span>, <span class="st">"bottom"</span>),</span>
|
||||
<span id="cb15-18"><a href="#cb15-18" aria-hidden="true" tabindex="-1"></a> <span class="at">just =</span> <span class="fu">c</span>(<span class="st">"left"</span>, <span class="st">"bottom"</span>),</span>
|
||||
<span id="cb15-19"><a href="#cb15-19" aria-hidden="true" tabindex="-1"></a> <span class="at">align =</span> <span class="st">"left"</span>) <span class="sc">+</span></span>
|
||||
<span id="cb15-20"><a href="#cb15-20" aria-hidden="true" tabindex="-1"></a> <span class="fu">tm_layout</span>(<span class="at">asp =</span> <span class="cn">NA</span>,</span>
|
||||
<span id="cb15-21"><a href="#cb15-21" aria-hidden="true" tabindex="-1"></a> <span class="at">frame =</span> <span class="cn">FALSE</span>, </span>
|
||||
<span id="cb15-22"><a href="#cb15-22" aria-hidden="true" tabindex="-1"></a> <span class="at">title =</span> <span class="st">"Figure 1a"</span>, </span>
|
||||
<span id="cb15-23"><a href="#cb15-23" aria-hidden="true" tabindex="-1"></a> <span class="at">title.size =</span> .<span class="dv">7</span>,</span>
|
||||
<span id="cb15-24"><a href="#cb15-24" aria-hidden="true" tabindex="-1"></a> <span class="at">legend.title.size =</span> .<span class="dv">7</span>,</span>
|
||||
<span id="cb15-25"><a href="#cb15-25" aria-hidden="true" tabindex="-1"></a> <span class="at">inner.margins =</span> <span class="fu">c</span>(<span class="fl">0.1</span>, <span class="fl">0.1</span>, <span class="fl">0.05</span>, <span class="fl">0.05</span>)</span>
|
||||
<span id="cb15-26"><a href="#cb15-26" aria-hidden="true" tabindex="-1"></a> )</span>
|
||||
<span id="cb15-27"><a href="#cb15-27" aria-hidden="true" tabindex="-1"></a></span>
|
||||
<span id="cb15-28"><a href="#cb15-28" aria-hidden="true" tabindex="-1"></a>map1</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
|
||||
<div class="sourceCode cell-code" id="cb10"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb10-1"><a href="#cb10-1" aria-hidden="true" tabindex="-1"></a><span class="co"># Generate choropleth map of respondent locations</span></span>
|
||||
<span id="cb10-2"><a href="#cb10-2" aria-hidden="true" tabindex="-1"></a><span class="co"># using temporary palette here so that 0s are white</span></span>
|
||||
<span id="cb10-3"><a href="#cb10-3" aria-hidden="true" tabindex="-1"></a><span class="fu">library</span>(tmap) <span class="sc">|></span> <span class="fu">suppressPackageStartupMessages</span>()</span>
|
||||
<span id="cb10-4"><a href="#cb10-4" aria-hidden="true" tabindex="-1"></a><span class="co"># palette <- c(white, "#a8ddb5", "#43a2ca")</span></span>
|
||||
<span id="cb10-5"><a href="#cb10-5" aria-hidden="true" tabindex="-1"></a></span>
|
||||
<span id="cb10-6"><a href="#cb10-6" aria-hidden="true" tabindex="-1"></a>map1 <span class="ot"><-</span> <span class="fu">tm_shape</span>(local_authorities) <span class="sc">+</span> </span>
|
||||
<span id="cb10-7"><a href="#cb10-7" aria-hidden="true" tabindex="-1"></a><span class="co"># tm_fill(col = "surveys_count", , palette = palette, title = "Concentration of survey respondents") +</span></span>
|
||||
<span id="cb10-8"><a href="#cb10-8" aria-hidden="true" tabindex="-1"></a> <span class="fu">tm_borders</span>(<span class="at">alpha=</span>.<span class="dv">5</span>, <span class="at">lwd=</span><span class="fl">0.1</span>) <span class="sc">+</span></span>
|
||||
<span id="cb10-9"><a href="#cb10-9" aria-hidden="true" tabindex="-1"></a> <span class="co"># for intermediate polygon geometries</span></span>
|
||||
<span id="cb10-10"><a href="#cb10-10" aria-hidden="true" tabindex="-1"></a> <span class="co"># tm_shape(local_authorities) +</span></span>
|
||||
<span id="cb10-11"><a href="#cb10-11" aria-hidden="true" tabindex="-1"></a> <span class="co"># tm_borders(lwd=0.6) +</span></span>
|
||||
<span id="cb10-12"><a href="#cb10-12" aria-hidden="true" tabindex="-1"></a> <span class="co"># for dots from original dataset</span></span>
|
||||
<span id="cb10-13"><a href="#cb10-13" aria-hidden="true" tabindex="-1"></a> <span class="co"># tm_dots("red", size = .05, alpha = .4) +</span></span>
|
||||
<span id="cb10-14"><a href="#cb10-14" aria-hidden="true" tabindex="-1"></a> <span class="fu">tm_scale_bar</span>(<span class="at">position =</span> <span class="fu">c</span>(<span class="st">"right"</span>, <span class="st">"bottom"</span>)) <span class="sc">+</span></span>
|
||||
<span id="cb10-15"><a href="#cb10-15" aria-hidden="true" tabindex="-1"></a> <span class="fu">tm_style</span>(<span class="st">"gray"</span>) <span class="sc">+</span></span>
|
||||
<span id="cb10-16"><a href="#cb10-16" aria-hidden="true" tabindex="-1"></a> <span class="fu">tm_credits</span>(<span class="st">"Data: UK Data Service (OGL)</span><span class="sc">\n</span><span class="st">& Jeremy H. Kidwell,</span><span class="sc">\n</span><span class="st">Graphic is CC-by-SA 4.0"</span>, </span>
|
||||
<span id="cb10-17"><a href="#cb10-17" aria-hidden="true" tabindex="-1"></a> <span class="at">size =</span> <span class="fl">0.4</span>, </span>
|
||||
<span id="cb10-18"><a href="#cb10-18" aria-hidden="true" tabindex="-1"></a> <span class="at">position =</span> <span class="fu">c</span>(<span class="st">"left"</span>, <span class="st">"bottom"</span>),</span>
|
||||
<span id="cb10-19"><a href="#cb10-19" aria-hidden="true" tabindex="-1"></a> <span class="at">just =</span> <span class="fu">c</span>(<span class="st">"left"</span>, <span class="st">"bottom"</span>),</span>
|
||||
<span id="cb10-20"><a href="#cb10-20" aria-hidden="true" tabindex="-1"></a> <span class="at">align =</span> <span class="st">"left"</span>) <span class="sc">+</span></span>
|
||||
<span id="cb10-21"><a href="#cb10-21" aria-hidden="true" tabindex="-1"></a> <span class="fu">tm_layout</span>(<span class="at">asp =</span> <span class="cn">NA</span>,</span>
|
||||
<span id="cb10-22"><a href="#cb10-22" aria-hidden="true" tabindex="-1"></a> <span class="at">frame =</span> <span class="cn">FALSE</span>, </span>
|
||||
<span id="cb10-23"><a href="#cb10-23" aria-hidden="true" tabindex="-1"></a> <span class="at">title =</span> <span class="st">"Figure 1a"</span>, </span>
|
||||
<span id="cb10-24"><a href="#cb10-24" aria-hidden="true" tabindex="-1"></a> <span class="at">title.size =</span> .<span class="dv">7</span>,</span>
|
||||
<span id="cb10-25"><a href="#cb10-25" aria-hidden="true" tabindex="-1"></a> <span class="at">legend.title.size =</span> .<span class="dv">7</span>,</span>
|
||||
<span id="cb10-26"><a href="#cb10-26" aria-hidden="true" tabindex="-1"></a> <span class="at">inner.margins =</span> <span class="fu">c</span>(<span class="fl">0.1</span>, <span class="fl">0.1</span>, <span class="fl">0.05</span>, <span class="fl">0.05</span>)</span>
|
||||
<span id="cb10-27"><a href="#cb10-27" aria-hidden="true" tabindex="-1"></a> )</span>
|
||||
<span id="cb10-28"><a href="#cb10-28" aria-hidden="true" tabindex="-1"></a></span>
|
||||
<span id="cb10-29"><a href="#cb10-29" aria-hidden="true" tabindex="-1"></a>map1</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
|
||||
<div class="cell-output-display">
|
||||
<p><img src="chapter_3_files/figure-html/unnamed-chunk-4-1.png" class="img-fluid" width="672"></p>
|
||||
</div>
|
||||
<div class="sourceCode cell-code" id="cb16"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb16-1"><a href="#cb16-1" aria-hidden="true" tabindex="-1"></a><span class="co"># save image</span></span>
|
||||
<span id="cb16-2"><a href="#cb16-2" aria-hidden="true" tabindex="-1"></a><span class="fu">tmap_save</span>(map1, <span class="fu">here</span>(<span class="st">"figures"</span>, <span class="st">"map.png"</span>), <span class="at">width=</span><span class="dv">1920</span>, <span class="at">height=</span><span class="dv">1080</span>, <span class="at">asp=</span><span class="dv">0</span>)</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
|
||||
<div class="sourceCode cell-code" id="cb11"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb11-1"><a href="#cb11-1" aria-hidden="true" tabindex="-1"></a><span class="co"># save image</span></span>
|
||||
<span id="cb11-2"><a href="#cb11-2" aria-hidden="true" tabindex="-1"></a><span class="fu">tmap_save</span>(map1, <span class="fu">here</span>(<span class="st">"figures"</span>, <span class="st">"map.png"</span>), <span class="at">width=</span><span class="dv">1920</span>, <span class="at">height=</span><span class="dv">1080</span>, <span class="at">asp=</span><span class="dv">0</span>)</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
|
||||
<div class="cell-output cell-output-stderr">
|
||||
<pre><code>Map saved to /Users/kidwellj/gits/hacking_religion_textbook/hacking_religion/figures/map.png</code></pre>
|
||||
</div>
|
||||
|
@ -396,35 +368,29 @@ Projected CRS: OSGB36 / British National Grid</code></pre>
|
|||
</div>
|
||||
</div>
|
||||
<div class="cell">
|
||||
<div class="sourceCode cell-code" id="cb20"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb20-1"><a href="#cb20-1" aria-hidden="true" tabindex="-1"></a><span class="co"># subsetting ordnance survey openmap data for measuring clusters and proximity</span></span>
|
||||
<span id="cb20-2"><a href="#cb20-2" aria-hidden="true" tabindex="-1"></a></span>
|
||||
<span id="cb20-3"><a href="#cb20-3" aria-hidden="true" tabindex="-1"></a>os_openmap_important_buildings <span class="ot"><-</span> <span class="fu">st_read</span>(<span class="fu">here</span>(<span class="st">"data"</span>, <span class="st">"os_openmap_important_buildings.gpkg"</span>))</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
|
||||
<div class="cell-output cell-output-stdout">
|
||||
<pre><code>Reading layer `important_buildings' from data source
|
||||
`/Users/kidwellj/gits/hacking_religion_textbook/hacking_religion/data/os_openmap_important_buildings.gpkg'
|
||||
using driver `GPKG'
|
||||
Simple feature collection with 229800 features and 5 fields
|
||||
Geometry type: POLYGON
|
||||
Dimension: XY
|
||||
Bounding box: xmin: 64594.12 ymin: 8125.44 xmax: 655500.5 ymax: 1214662
|
||||
Projected CRS: OSGB36 / British National Grid</code></pre>
|
||||
</div>
|
||||
<div class="sourceCode cell-code" id="cb22"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb22-1"><a href="#cb22-1" aria-hidden="true" tabindex="-1"></a><span class="co"># add pubs, check_cashing, pawnbrokers, SSSI</span></span>
|
||||
<span id="cb22-2"><a href="#cb22-2" aria-hidden="true" tabindex="-1"></a><span class="do">## subsets</span></span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
|
||||
<div class="sourceCode cell-code" id="cb15"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb15-1"><a href="#cb15-1" aria-hidden="true" tabindex="-1"></a><span class="co"># subsetting ordnance survey openmap data for measuring clusters and proximity</span></span>
|
||||
<span id="cb15-2"><a href="#cb15-2" aria-hidden="true" tabindex="-1"></a></span>
|
||||
<span id="cb15-3"><a href="#cb15-3" aria-hidden="true" tabindex="-1"></a>os_openmap_important_buildings <span class="ot"><-</span> <span class="fu">st_read</span>(<span class="fu">here</span>(<span class="st">"data"</span>, <span class="st">"os_openmap_important_buildings.gpkg"</span>), <span class="at">quiet =</span> <span class="cn">TRUE</span>)</span>
|
||||
<span id="cb15-4"><a href="#cb15-4" aria-hidden="true" tabindex="-1"></a></span>
|
||||
<span id="cb15-5"><a href="#cb15-5" aria-hidden="true" tabindex="-1"></a><span class="co"># add pubs, check_cashing, pawnbrokers, SSSI</span></span>
|
||||
<span id="cb15-6"><a href="#cb15-6" aria-hidden="true" tabindex="-1"></a><span class="do">## subsets</span></span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
|
||||
</div>
|
||||
<ol type="1">
|
||||
<li>Count the number of churches in Local Authorities</li>
|
||||
</ol>
|
||||
<div class="cell">
|
||||
<div class="sourceCode cell-code" id="cb23"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb23-1"><a href="#cb23-1" aria-hidden="true" tabindex="-1"></a><span class="co"># OSM data</span></span>
|
||||
<span id="cb23-2"><a href="#cb23-2" aria-hidden="true" tabindex="-1"></a></span>
|
||||
<span id="cb23-3"><a href="#cb23-3" aria-hidden="true" tabindex="-1"></a><span class="co"># Note: for more advanced reproducible scripts which demonstrate how these data surces have been </span></span>
|
||||
<span id="cb23-4"><a href="#cb23-4" aria-hidden="true" tabindex="-1"></a><span class="co"># obtained, see the companion cookbook here: https://github.com/kidwellj/hacking_religion_cookbook/blob/main/ordnance_survey.R</span></span>
|
||||
<span id="cb23-5"><a href="#cb23-5" aria-hidden="true" tabindex="-1"></a></span>
|
||||
<span id="cb23-6"><a href="#cb23-6" aria-hidden="true" tabindex="-1"></a></span>
|
||||
<span id="cb23-7"><a href="#cb23-7" aria-hidden="true" tabindex="-1"></a><span class="co"># osm_uk_points <- st_read(system.file(here("data", "pow_osm.gpkg", package = "spData")))</span></span>
|
||||
<span id="cb23-8"><a href="#cb23-8" aria-hidden="true" tabindex="-1"></a><span class="co"># vector_filepath = system.file("data/osm-gb-2018Aug29_pow_osm.pbf", package = "sf")</span></span>
|
||||
<span id="cb23-9"><a href="#cb23-9" aria-hidden="true" tabindex="-1"></a><span class="co"># osm_uk_points = st_read(vector_filepath)</span></span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
|
||||
<div class="sourceCode cell-code" id="cb16"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb16-1"><a href="#cb16-1" aria-hidden="true" tabindex="-1"></a><span class="co"># OSM data</span></span>
|
||||
<span id="cb16-2"><a href="#cb16-2" aria-hidden="true" tabindex="-1"></a></span>
|
||||
<span id="cb16-3"><a href="#cb16-3" aria-hidden="true" tabindex="-1"></a><span class="co"># Note: for more advanced reproducible scripts which demonstrate how these data surces have been </span></span>
|
||||
<span id="cb16-4"><a href="#cb16-4" aria-hidden="true" tabindex="-1"></a><span class="co"># obtained, see the companion cookbook here: https://github.com/kidwellj/hacking_religion_cookbook/blob/main/ordnance_survey.R</span></span>
|
||||
<span id="cb16-5"><a href="#cb16-5" aria-hidden="true" tabindex="-1"></a></span>
|
||||
<span id="cb16-6"><a href="#cb16-6" aria-hidden="true" tabindex="-1"></a></span>
|
||||
<span id="cb16-7"><a href="#cb16-7" aria-hidden="true" tabindex="-1"></a><span class="co"># osm_uk_points <- st_read(system.file(here("data", "pow_osm.gpkg", package = "spData")))</span></span>
|
||||
<span id="cb16-8"><a href="#cb16-8" aria-hidden="true" tabindex="-1"></a><span class="co"># vector_filepath = system.file("data/osm-gb-2018Aug29_pow_osm.pbf", package = "sf")</span></span>
|
||||
<span id="cb16-9"><a href="#cb16-9" aria-hidden="true" tabindex="-1"></a><span class="co"># osm_uk_points = st_read(vector_filepath)</span></span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
|
||||
</div>
|
||||
<p>Guides to geographies: https://rconsortium.github.io/censusguide/ https://ocsi.uk/2019/03/18/lsoas-leps-and-lookups-a-beginners-guide-to-statistical-geographies/</p>
|
||||
<p>Extact places of worship from Ordnance survey open data set Calculate proximity to pubs</p>
|
||||
<p>Calculate proximity to pubs</p>
|
||||
</section>
|
||||
<section id="references" class="level1 unnumbered">
|
||||
<h1 class="unnumbered">References</h1>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue