You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
<p>On that basis, to show what I meant by reproducibility and ‘data carpentry’ <spanclass="citation">(<ahref="#ref-gillespie_efficient_2016" role="doc-biblioref"><strong>gillespie_efficient_2016?</strong></a>)</span> (a concept mentioned in the slides not discussed in audio for lack of time) I provided some some example code that illustrated the kinds of techniques underlying the PCT.</p>
81
+
<p>On that basis, to show what I meant by reproducibility and ‘data carpentry’ <spanclass="citation">(<ahref="#ref-gillespie_efficient_2016" role="doc-biblioref">Gillespie and Lovelace 2016</a>)</span> (a concept mentioned in the slides not discussed in audio for lack of time) I provided some some example code that illustrated the kinds of techniques underlying the PCT.</p>
82
82
<p>First download and visualise some transport data (from the Isle of Wight as, the smallest region in the PCT):</p>
<p>Now that we have an idea of the commute patterns in the area, and the nature of ‘OD’ data (converted to geographical desire lines with the <strong><ahref="https://github.com/ropensci/stplanr">stplanr</a></strong> package), we can do some analysis.</p>
92
91
<preclass="r"><code>sel_walk = l$foot > 9
93
92
l_walk = l[sel_walk,]
94
-
plot(l)</code></pre>
95
-
<pre><code>## Warning in wkt(obj): CRS object has no comment</code></pre>
96
-
<preclass="r"><code>plot(l_walk, add = T, col = "red", lwd = 3)</code></pre>
93
+
plot(l)
94
+
plot(l_walk, add = T, col = "red", lwd = 3)</code></pre>
<preclass="r"><code>library(dplyr) # for next slide...</code></pre>
99
-
<p>The above code subsets all the lines that have 10 or more people walking to work in the 2011 census and plots the results (as you’d expect the shorter trips are more commonly walked). It works, but could be interpretted as a little clunky. Enter <ahref="https://github.com/tidyverse/dplyr"><strong>dplyr</strong></a>, a package for data science <spanclass="citation">(<ahref="#ref-grolemund_r_2016" role="doc-biblioref"><strong>grolemund_r_2016?</strong></a>)</span>:</p>
97
+
<p>The above code subsets all the lines that have 10 or more people walking to work in the 2011 census and plots the results (as you’d expect the shorter trips are more commonly walked). It works, but could be interpretted as a little clunky. Enter <ahref="https://github.com/tidyverse/dplyr"><strong>dplyr</strong></a>, a package for data science <spanclass="citation">(<ahref="#ref-grolemund_r_2016" role="doc-biblioref">Grolemund and Wickham 2016</a>)</span>:</p>
100
98
<preclass="r"><code>l_walk1 = l %>% filter(All > 10) # fails</code></pre>
101
99
<p>Doh! That code nice ‘clean’ (well certainly consistent) code does not work because <code>Spatial</code> objects are not compatible with the pipe operator <code>%>%</code> syntax.</p>
102
100
<p>Enter the <ahref="https://github.com/edzer/sfr"><strong>sf</strong></a> package, which represents a step change in how R handles spatial data. First let’s convert that <code>l</code> object into a ‘simple feature’ object:</p>
103
101
<preclass="r"><code>library(sf)</code></pre>
104
-
<pre><code>## Linking to GEOS 3.8.0, GDAL 3.0.4, PROJ 7.0.0</code></pre>
105
-
<preclass="r"><code>l_sf = st_as_sf(l)
106
-
class(l_sf)</code></pre>
102
+
<pre><code>## Linking to GEOS 3.8.0, GDAL 3.0.4, PROJ 6.3.1</code></pre>
Arribas-Bel, Daniel. 2014. <span>“Accidental, Open and Everywhere: <span>Emerging</span> Data Sources for the Understanding of Cities.”</span><em>Applied Geography</em> 49: 45–53.
Gillespie, Colin, and Robin Lovelace. 2016. <em>Efficient <span>R Programming</span>: <span>A Practical Guide</span> to <span>Smarter Programming</span></em>. <span>O’Reilly Media</span>. <ahref="https://csgillespie.github.io/efficientR/">https://csgillespie.github.io/efficientR/</a>.
149
+
</div>
150
+
<divid="ref-grolemund_r_2016" class="csl-entry">
151
+
Grolemund, Garrett, and Hadley Wickham. 2016. <em>R for <span>Data Science</span></em>. 1 edition. <span>O’Reilly Media</span>.
152
+
</div>
147
153
<divid="ref-lovelace_big_2016" class="csl-entry">
148
154
Lovelace, Robin, Mark Birkin, Philip Cross, and Martin Clarke. 2016. <span>“From <span>Big Noise</span> to <span>Big Data</span>: <span>Toward</span> the <span>Verification</span> of <span>Large Data</span> Sets for <span>Understanding Regional Retail Flows</span>.”</span><em>Geographical Analysis</em> 48 (1): 59–81. <ahref="https://doi.org/10.1111/gean.12081">https://doi.org/10.1111/gean.12081</a>.
0 commit comments