Skip to content

Commit 71ba595

Browse files
committed
Deploy commit: Update exercises before tackling #766 a28def3
1 parent 2bca540 commit 71ba595

29 files changed

+528
-398
lines changed

Diff for: 04-spatial-operations.md

+4-1
Original file line numberDiff line numberDiff line change
@@ -983,9 +983,12 @@ data(nz_height, package = "spData")
983983
E1. It was established in Section \@ref(spatial-vec) that Canterbury was the region of New Zealand containing most of the 100 highest points in the country.
984984
How many of these high points does the Canterbury region contain?
985985

986+
**Bonus:** plot the result using the `plot()` function to show all of New Zealand, `canterbury` region highlighted in yellow, high points in Canterbury represented with black dots and
986987

987988

988-
E2. Which region has the second highest number of `nz_height` points in, and how many does it have?
989+
990+
991+
E2. Which region has the second highest number of `nz_height` points, and how many does it have?
989992

990993

991994

Loading
0 Bytes
Loading

Diff for: 09-mapping_files/figure-html/layout3-1.png

-4.71 KB
Loading

Diff for: 09-mapping_files/figure-html/tmstyles-1.png

-33 Bytes
Loading

Diff for: 404.html

+3-3
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
<title>Geocomputation with R</title>
88
<meta name="author" content="Robin Lovelace, Jakub Nowosad, Jannes Muenchow">
99
<meta name="description" content="Geocomputation with R is for people who want to analyze, visualize and model geographic data with open source software. It is based on R, a statistical programming language that has powerful data processing, visualization, and geospatial capabilities. The book equips you with the knowledge and skills to tackle a wide range of issues manifested in geographic data, including those with scientific, societal, and environmental implications. This book will interest people from many backgrounds, especially Geographic Information Systems (GIS) users interested in applying their domain-specific knowledge in a powerful open source language for data science, and R users interested in extending their skills to handle spatial data.">
10-
<meta name="generator" content="bookdown 0.24 with bs4_book()">
10+
<meta name="generator" content="bookdown 0.25 with bs4_book()">
1111
<meta property="og:title" content="Geocomputation with R">
1212
<meta property="og:type" content="book">
1313
<meta property="og:url" content="https://geocompr.robinlovelace.net/404.html">
@@ -17,7 +17,7 @@
1717
<meta name="twitter:title" content="Geocomputation with R">
1818
<meta name="twitter:description" content="Geocomputation with R is for people who want to analyze, visualize and model geographic data with open source software. It is based on R, a statistical programming language that has powerful data processing, visualization, and geospatial capabilities. The book equips you with the knowledge and skills to tackle a wide range of issues manifested in geographic data, including those with scientific, societal, and environmental implications. This book will interest people from many backgrounds, especially Geographic Information Systems (GIS) users interested in applying their domain-specific knowledge in a powerful open source language for data science, and R users interested in extending their skills to handle spatial data.">
1919
<meta name="twitter:image" content="https://geocompr.robinlovelace.net/images/cover.png">
20-
<!-- JS --><script src="https://cdnjs.cloudflare.com/ajax/libs/clipboard.js/2.0.6/clipboard.min.js" integrity="sha256-inc5kl9MA1hkeYUt+EC3BhlIgyp/2jDIyBLS6k3UxPI=" crossorigin="anonymous"></script><script src="https://cdnjs.cloudflare.com/ajax/libs/fuse.js/6.4.6/fuse.js" integrity="sha512-zv6Ywkjyktsohkbp9bb45V6tEMoWhzFzXis+LrMehmJZZSys19Yxf1dopHx7WzIKxr5tK2dVcYmaCk2uqdjF4A==" crossorigin="anonymous"></script><script src="https://kit.fontawesome.com/6ecbd6c532.js" crossorigin="anonymous"></script><script src="libs/header-attrs-2.12/header-attrs.js"></script><script src="libs/jquery-3.6.0/jquery-3.6.0.min.js"></script><meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
20+
<!-- JS --><script src="https://cdnjs.cloudflare.com/ajax/libs/clipboard.js/2.0.6/clipboard.min.js" integrity="sha256-inc5kl9MA1hkeYUt+EC3BhlIgyp/2jDIyBLS6k3UxPI=" crossorigin="anonymous"></script><script src="https://cdnjs.cloudflare.com/ajax/libs/fuse.js/6.4.6/fuse.js" integrity="sha512-zv6Ywkjyktsohkbp9bb45V6tEMoWhzFzXis+LrMehmJZZSys19Yxf1dopHx7WzIKxr5tK2dVcYmaCk2uqdjF4A==" crossorigin="anonymous"></script><script src="https://kit.fontawesome.com/6ecbd6c532.js" crossorigin="anonymous"></script><script src="libs/jquery-3.6.0/jquery-3.6.0.min.js"></script><meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
2121
<link href="libs/bootstrap-4.6.0/bootstrap.min.css" rel="stylesheet">
2222
<script src="libs/bootstrap-4.6.0/bootstrap.bundle.min.js"></script><link href="libs/_Lato-0.4.0/font.css" rel="stylesheet">
2323
<link href="libs/_Roboto%20Mono-0.4.0/font.css" rel="stylesheet">
@@ -113,7 +113,7 @@ <h2>Note: Second Edition is under construction 🏗</h2>
113113
<footer class="bg-primary text-light mt-5"><div class="container"><div class="row">
114114

115115
<div class="col-12 col-md-6 mt-3">
116-
<p>"<strong>Geocomputation with R</strong>" was written by Robin Lovelace, Jakub Nowosad, Jannes Muenchow. It was last built on 2022-03-17.</p>
116+
<p>"<strong>Geocomputation with R</strong>" was written by Robin Lovelace, Jakub Nowosad, Jannes Muenchow. It was last built on 2022-03-18.</p>
117117
</div>
118118

119119
<div class="col-12 col-md-6 mt-3">

Diff for: adv-map.html

+11-7
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
<title>Chapter 9 Making maps with R | Geocomputation with R</title>
88
<meta name="author" content="Robin Lovelace, Jakub Nowosad, Jannes Muenchow">
99
<meta name="description" content="Prerequisites This chapter requires the following packages that we have already been using: library(sf) library(raster) library(dplyr) library(spData) library(spDataLarge) In addition, it uses the...">
10-
<meta name="generator" content="bookdown 0.24 with bs4_book()">
10+
<meta name="generator" content="bookdown 0.25 with bs4_book()">
1111
<meta property="og:title" content="Chapter 9 Making maps with R | Geocomputation with R">
1212
<meta property="og:type" content="book">
1313
<meta property="og:url" content="https://geocompr.robinlovelace.net/adv-map.html">
@@ -17,7 +17,7 @@
1717
<meta name="twitter:title" content="Chapter 9 Making maps with R | Geocomputation with R">
1818
<meta name="twitter:description" content="Prerequisites This chapter requires the following packages that we have already been using: library(sf) library(raster) library(dplyr) library(spData) library(spDataLarge) In addition, it uses the...">
1919
<meta name="twitter:image" content="https://geocompr.robinlovelace.net/images/cover.png">
20-
<!-- JS --><script src="https://cdnjs.cloudflare.com/ajax/libs/clipboard.js/2.0.6/clipboard.min.js" integrity="sha256-inc5kl9MA1hkeYUt+EC3BhlIgyp/2jDIyBLS6k3UxPI=" crossorigin="anonymous"></script><script src="https://cdnjs.cloudflare.com/ajax/libs/fuse.js/6.4.6/fuse.js" integrity="sha512-zv6Ywkjyktsohkbp9bb45V6tEMoWhzFzXis+LrMehmJZZSys19Yxf1dopHx7WzIKxr5tK2dVcYmaCk2uqdjF4A==" crossorigin="anonymous"></script><script src="https://kit.fontawesome.com/6ecbd6c532.js" crossorigin="anonymous"></script><script src="libs/header-attrs-2.12/header-attrs.js"></script><script src="libs/jquery-3.6.0/jquery-3.6.0.min.js"></script><meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
20+
<!-- JS --><script src="https://cdnjs.cloudflare.com/ajax/libs/clipboard.js/2.0.6/clipboard.min.js" integrity="sha256-inc5kl9MA1hkeYUt+EC3BhlIgyp/2jDIyBLS6k3UxPI=" crossorigin="anonymous"></script><script src="https://cdnjs.cloudflare.com/ajax/libs/fuse.js/6.4.6/fuse.js" integrity="sha512-zv6Ywkjyktsohkbp9bb45V6tEMoWhzFzXis+LrMehmJZZSys19Yxf1dopHx7WzIKxr5tK2dVcYmaCk2uqdjF4A==" crossorigin="anonymous"></script><script src="https://kit.fontawesome.com/6ecbd6c532.js" crossorigin="anonymous"></script><script src="libs/jquery-3.6.0/jquery-3.6.0.min.js"></script><meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
2121
<link href="libs/bootstrap-4.6.0/bootstrap.min.css" rel="stylesheet">
2222
<script src="libs/bootstrap-4.6.0/bootstrap.bundle.min.js"></script><link href="libs/_Lato-0.4.0/font.css" rel="stylesheet">
2323
<link href="libs/_Roboto%20Mono-0.4.0/font.css" rel="stylesheet">
@@ -260,7 +260,8 @@ <h3>
260260
The purpose of this section is to show how.</p>
261261
<p>There are two main types of map aesthetics: those that change with the data and those that are constant.
262262
Unlike <strong>ggplot2</strong>, which uses the helper function <code><a href="https://ggplot2.tidyverse.org/reference/aes.html">aes()</a></code> to represent variable aesthetics, <strong>tmap</strong> accepts aesthetic arguments directly.
263-
To map a variable to an aesthetic, pass its column name to the corresponding argument, and to set a fixed aesthetic, pass the desired value instead.<a href="references.html#fn42" class="footnote-ref" id="fnref42"><sup>42</sup></a>
263+
To map a variable to an aesthetic, pass its column name to the corresponding argument, and to set a fixed aesthetic, pass the desired value instead.<a class="footnote-ref" tabindex="0" data-toggle="popover" data-content="&lt;p&gt;
264+
If there is a clash between a fixed value and a column name, the column name takes precedence. This can be verified by running the next code chunk after running &lt;code&gt;nz$red = 1:nrow(nz)&lt;/code&gt;.&lt;/p&gt;"><sup>42</sup></a>
264265
The most commonly used aesthetics for fill and border layers include color, transparency, line width and line type, set with <code>col</code>, <code>alpha</code>, <code>lwd</code>, and <code>lty</code> arguments, respectively.
265266
The impact of setting these with fixed values is illustrated in Figure <a href="adv-map.html#fig:tmstatic">9.3</a>.</p>
266267
<div class="sourceCode" id="cb302"><pre class="downlit sourceCode r">
@@ -366,7 +367,8 @@ <h3>
366367
<p>There are three main groups of color palettes: categorical, sequential and diverging (Figure <a href="adv-map.html#fig:colpal">9.7</a>), and each of them serves a different purpose.
367368
Categorical palettes consist of easily distinguishable colors and are most appropriate for categorical data without any particular order such as state names or land cover classes.
368369
Colors should be intuitive: rivers should be blue, for example, and pastures green.
369-
Avoid too many categories: maps with large legends and many colors can be uninterpretable.<a href="references.html#fn43" class="footnote-ref" id="fnref43"><sup>43</sup></a></p>
370+
Avoid too many categories: maps with large legends and many colors can be uninterpretable.<a class="footnote-ref" tabindex="0" data-toggle="popover" data-content='&lt;p&gt;
371+
&lt;code&gt;col = "MAP_COLORS"&lt;/code&gt; can be used in maps with a large number of individual polygons (for example, a map of individual countries) to create unique colors for adjacent polygons.&lt;/p&gt;'><sup>43</sup></a></p>
370372
<p>The second group is sequential palettes.
371373
These follow a gradient, for example from light to dark colors (light colors tend to represent lower values), and are appropriate for continuous (numeric) variables.
372374
Sequential palettes can be single (<code>Blues</code> go from light to dark blue, for example) or multi-color/hue (<code>YlOrBr</code> is gradient from light yellow to brown via orange, for example), as demonstrated in the code chunk below — output not shown, run the code yourself to see the results!</p>
@@ -391,7 +393,7 @@ <h3>
391393
This property is not preserved in the rainbow color palette; therefore, we suggest avoiding it in geographic data visualization <span class="citation">(<a href="references.html#ref-borland_rainbow_2007" role="doc-biblioref">Borland and Taylor II 2007</a>)</span>.
392394
Instead, <a href="https://cran.r-project.org/web/packages/viridis/">the viridis color palettes</a>, also available in <strong>tmap</strong>, can be used.
393395
Secondly, changes in colors should be accessible to the largest number of people.
394-
Therefore, it is important to use colorblind friendly palettes as often as possible.<a href="references.html#fn44" class="footnote-ref" id="fnref44"><sup>44</sup></a></p>
396+
Therefore, it is important to use colorblind friendly palettes as often as possible.<a class="footnote-ref" tabindex="0" data-toggle="popover" data-content="&lt;p&gt;See the “Color blindness simulator” options in &lt;code&gt;tmaptools::palette_explorer()&lt;/code&gt;.&lt;/p&gt;"><sup>44</sup></a></p>
395397
</div>
396398
<div id="layouts" class="section level3" number="9.2.5">
397399
<h3>
@@ -798,7 +800,8 @@ <h2>
798800
<code>shiny-server</code> also serves apps defined by a single <code>app.R</code> file in an ‘app folder’.
799801
Learn more at: <a href="https://github.com/rstudio/shiny-server" class="uri">https://github.com/rstudio/shiny-server</a>.
800802
</div>
801-
<p>Before considering large apps, it is worth seeing a minimal example, named ‘lifeApp’, in action.<a href="references.html#fn45" class="footnote-ref" id="fnref45"><sup>45</sup></a>
803+
<p>Before considering large apps, it is worth seeing a minimal example, named ‘lifeApp’, in action.<a class="footnote-ref" tabindex="0" data-toggle="popover" data-content="&lt;p&gt;
804+
The word ‘app’ in this context refers to ‘web application’ and should not be confused with smartphone apps, the more common meaning of the word.&lt;/p&gt;"><sup>45</sup></a>
802805
The code below defines and launches — with the command <code><a href="https://rdrr.io/pkg/shiny/man/shinyApp.html">shinyApp()</a></code> — a lifeApp, which provides an interactive slider allowing users to make countries appear with progressively lower levels of life expectancy (see Figure <a href="adv-map.html#fig:lifeApp">9.24</a>):</p>
803806
<div class="sourceCode" id="cb329"><pre class="downlit sourceCode r">
804807
<code class="sourceCode R"><span class="kw"><a href="https://rdrr.io/r/base/library.html">library</a></span><span class="op">(</span><span class="va"><a href="https://shiny.rstudio.com/">shiny</a></span><span class="op">)</span> <span class="co"># for shiny apps</span>
@@ -1189,6 +1192,7 @@ <h2>
11891192
</ol>
11901193
</div>
11911194
</div>
1195+
11921196
<div class="chapter-nav">
11931197
<div class="prev"><a href="read-write.html"><span class="header-section-number">8</span> Geographic data I/O</a></div>
11941198
<div class="next"><a href="gis.html"><span class="header-section-number">10</span> Bridges to GIS software</a></div>
@@ -1241,7 +1245,7 @@ <h2>Note: Second Edition is under construction 🏗</h2>
12411245
<footer class="bg-primary text-light mt-5"><div class="container"><div class="row">
12421246

12431247
<div class="col-12 col-md-6 mt-3">
1244-
<p>"<strong>Geocomputation with R</strong>" was written by Robin Lovelace, Jakub Nowosad, Jannes Muenchow. It was last built on 2022-03-17.</p>
1248+
<p>"<strong>Geocomputation with R</strong>" was written by Robin Lovelace, Jakub Nowosad, Jannes Muenchow. It was last built on 2022-03-18.</p>
12451249
</div>
12461250

12471251
<div class="col-12 col-md-6 mt-3">

0 commit comments

Comments
 (0)