|
172 | 172 | <span><span class="va">dem</span> <span class="op">=</span> <span class="fu"><a href="https://rspatial.github.io/terra/reference/rast.html">rast</a></span><span class="op">(</span><span class="fu"><a href="https://rdrr.io/r/base/system.file.html">system.file</a></span><span class="op">(</span><span class="st">"raster/dem.tif"</span>, package <span class="op">=</span> <span class="st">"spDataLarge"</span><span class="op">)</span><span class="op">)</span></span> |
173 | 173 | <span><span class="va">ndvi</span> <span class="op">=</span> <span class="fu"><a href="https://rspatial.github.io/terra/reference/rast.html">rast</a></span><span class="op">(</span><span class="fu"><a href="https://rdrr.io/r/base/system.file.html">system.file</a></span><span class="op">(</span><span class="st">"raster/ndvi.tif"</span>, package <span class="op">=</span> <span class="st">"spDataLarge"</span><span class="op">)</span><span class="op">)</span></span></code></pre></div> |
174 | 174 | <p><code>study_area</code> is a polygon representing the outline of the study area, and <code>random_points</code> is an <code>sf</code> object containing the 100 randomly chosen sites. |
175 | | -<code>comm</code> is a community matrix of the wide data format <span class="citation">(<a href="references.html#ref-wickham_tidy_2014">Wickham 2014</a>)</span> where the rows represent the visited sites in the field and the columns the observed species.<a class="footnote-ref" tabindex="0" data-toggle="popover" data-content="<p>In statistics, this is also called a contingency table or cross-table.</p>"><sup>101</sup></a></p> |
| 175 | +<code>comm</code> is a community matrix of the wide data format <span class="citation">(<a href="references.html#ref-wickham_tidy_2014">Wickham 2014</a>)</span> where the rows represent the visited sites in the field and the columns the observed species.<a class="footnote-ref" tabindex="0" data-toggle="popover" data-content="<p>In statistics, this is also called a contingency table or cross-table.</p>"><sup>100</sup></a></p> |
176 | 176 | <div class="sourceCode" id="cb491"><pre class="downlit sourceCode r"> |
177 | 177 | <code class="sourceCode R"><span><span class="co"># sites 35 to 40 and corresponding occurrences of the first five species in the</span></span> |
178 | 178 | <span><span class="co"># community matrix</span></span> |
|
198 | 198 | <p>The next step is to compute variables which are not only needed for the modeling and predictive mapping (see Section <a href="eco.html#predictive-mapping">15.4.2</a>) but also for aligning the non-metric multidimensional scaling (NMDS) axes with the main gradient in the study area, altitude and humidity, respectively (see Section <a href="eco.html#nmds">15.3</a>).</p> |
199 | 199 | <p>Specifically, we compute catchment slope and catchment area from a digital elevation model using R-GIS bridges (see Chapter <a href="gis.html#gis">10</a>). |
200 | 200 | Curvatures might also represent valuable predictors, and in the Exercise section you can find out how they would impact the modeling result.</p> |
201 | | -<p>To compute catchment area and catchment slope, we can make use of the <code>sagang:sagawetnessindex</code> function.<a class="footnote-ref" tabindex="0" data-toggle="popover" data-content="<p>Admittedly, it is a bit unsatisfying that the only way of knowing that <code>sagawetnessindex</code> computes the desired terrain attributes is to be familiar with SAGA.</p>"><sup>102</sup></a> |
| 201 | +<p>To compute catchment area and catchment slope, we can make use of the <code>sagang:sagawetnessindex</code> function.<a class="footnote-ref" tabindex="0" data-toggle="popover" data-content="<p>Admittedly, it is a bit unsatisfying that the only way of knowing that <code>sagawetnessindex</code> computes the desired terrain attributes is to be familiar with SAGA.</p>"><sup>101</sup></a> |
202 | 202 | <code><a href="https://r-spatial.github.io/qgisprocess/reference/qgis_show_help.html">qgis_show_help()</a></code> returns all function parameters and default values of a specific geoalgorithm. |
203 | 203 | Here, we present only a selection of the complete output.</p> |
204 | 204 | <div class="sourceCode" id="cb492"><pre class="downlit sourceCode r"> |
|
306 | 306 | <span><span class="va">pa</span> <span class="op">=</span> <span class="va">pa</span><span class="op">[</span><span class="fu"><a href="https://rspatial.github.io/terra/reference/rowSums.html">rowSums</a></span><span class="op">(</span><span class="va">pa</span><span class="op">)</span> <span class="op">!=</span> <span class="fl">0</span>, <span class="op">]</span> <span class="co"># 84 rows, 69 columns</span></span></code></pre></div> |
307 | 307 | <p>The resulting matrix serves as input for the NMDS. |
308 | 308 | <code>k</code> specifies the number of output axes, here, set to 4.<a class="footnote-ref" tabindex="0" data-toggle="popover" data-content='<p> |
309 | | -One way of choosing <code>k</code> is to try <code>k</code> values between 1 and 6 and then using the result which yields the best stress value <span class="citation">(<a href="references.html#ref-mccune_analysis_2002">McCune et al. 2002</a>)</span>.</p>'><sup>103</sup></a> |
| 309 | +One way of choosing <code>k</code> is to try <code>k</code> values between 1 and 6 and then using the result which yields the best stress value <span class="citation">(<a href="references.html#ref-mccune_analysis_2002">McCune et al. 2002</a>)</span>.</p>'><sup>102</sup></a> |
310 | 310 | NMDS is an iterative procedure trying to make the ordinated space more similar to the input matrix in each step. |
311 | 311 | To make sure that the algorithm converges, we set the number of steps to 500 using the <code>try</code> parameter.</p> |
312 | 312 | <div class="sourceCode" id="cb499"><pre class="downlit sourceCode r"> |
@@ -633,7 +633,7 @@ <h2>Second Edition</h2> |
633 | 633 | <footer class="bg-primary text-light mt-5"><div class="container"><div class="row"> |
634 | 634 |
|
635 | 635 | <div class="col-12 col-md-6 mt-3"> |
636 | | - <p>"<strong>Geocomputation with R</strong>" was written by Robin Lovelace, Jakub Nowosad, Jannes Muenchow. It was last built on 2026-01-28.</p> |
| 636 | + <p>"<strong>Geocomputation with R</strong>" was written by Robin Lovelace, Jakub Nowosad, Jannes Muenchow. It was last built on 2026-01-30.</p> |
637 | 637 | </div> |
638 | 638 |
|
639 | 639 | <div class="col-12 col-md-6 mt-3"> |
|
0 commit comments