-
-
Notifications
You must be signed in to change notification settings - Fork 584
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Complete rewrite of the Ecology chapter #771
Conversation
…rediction and plotting predictions
Merge branch 'main' into rewrite_eco # Conflicts: # 01-introduction.Rmd # 03-attribute-operations.Rmd # 05-geometry-operations.Rmd # 16-synthesis.Rmd # refs.bib
Many thanks @jannes-m this looks like an impressive piece of work. Will take a look now. |
First step: fix merge conflicts with the main branch. I'll give that a go now but may need your assistance @jannes-m if there are any ambiguities.. |
Seems this will merge it:
|
@@ -116,7 +116,7 @@ With a wide range of packages, R also supports advanced geospatial statistics\in | |||
\index{R!language} | |||
New integrated development environments (IDEs\index{IDE}) such as RStudio\index{RStudio} have made R more user-friendly for many, easing map making with a panel dedicated to interactive visualization. | |||
|
|||
At its core, R is an object-oriented, [functional programming language](http://adv-r.had.co.nz/Functional-programming.html) [@wickham_advanced_2019], and was specifically designed as an interactive interface to other software [@chambers_extending_2016]. | |||
At its core, R is an object-oriented, [functional programming language](https://adv-r.hadley.nz/fp.html) [@wickham_advanced_2019], and was specifically designed as an interactive interface to other software [@chambers_extending_2016]. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
@@ -6,21 +6,25 @@ This chapter assumes proficiency with geographic data analysis\index{geographic | |||
A familiarity with generalized linear models (GLM)\index{GLM} and machine learning\index{machine learning} is highly recommended [for example from @zuur_mixed_2009;@james_introduction_2013]. | |||
|
|||
The chapter uses the following packages:^[ | |||
Package **kernlab**, **pROC**, **RSAGA**\index{RSAGA (package)} and **spDataLarge** must also be installed although these do not need to be attached. | |||
Packages **GGally**, **lgr**, **kernlab**, **ml3measures**, **paradox**, **pROC**, **progressr** and **spDataLarge** must also be installed although these do not need to be attached. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
12-spatial-cv.Rmd
Outdated
library(sf) | ||
library(raster) | ||
library(terra) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
12-spatial-cv.Rmd
Outdated
library(mlr) | ||
library(parallelMap) | ||
```{r 12-spatial-cv-1-2, eval=FALSE} | ||
library(future) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
New dependency I think. We should update geocompkg
DESCRIPTION if so.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See PR here: geocompx/geocompkg#32
@@ -69,83 +73,64 @@ Spatial CV\index{cross-validation!spatial CV} alleviates this problem and is the | |||
## Case study: Landslide susceptibility {#case-landslide} | |||
|
|||
This case study is based on a dataset of landslide locations in Southern Ecuador, illustrated in Figure \@ref(fig:lsl-map) and described in detail in @muenchow_geomorphic_2012. | |||
A subset of the dataset used in that paper is provided in the **RSAGA**\index{RSAGA (package)} package, which can be loaded as follows: | |||
A subset of the dataset used in that paper is provided in the **spDataLarge**\index{spDataLarge (package)} package, which can be loaded as follows: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
library(dplyr) | ||
library(mlr3) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same comment: I suggest not loading all of these, some can be used with pkg::fun()
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This probably won't work. For example, you need to attach mlr3spatiotempcv to make available the spatial partitioning stuff used in mlr3::rsmp()
. Equally, you need to attach mlr3learners and mlr3extralearners to make available additional learners. And the autoplot()
function will only work with benchmark results if you have previoulsy attached mlr3viz to make the autoplot()
. And there are more examples.
@@ -40,7 +47,7 @@ In this chapter we will demonstrate ecological applications of some of the techn | |||
This case study will involve analyzing the composition and the spatial distribution of the vascular plants on the southern slope of Mt. Mongón, a *lomas* mountain near Casma on the central northern coast of Peru (Figure \@ref(fig:study-area-mongon)). | |||
|
|||
```{r study-area-mongon, echo=FALSE, fig.cap="The Mt. Mongón study area, from Muenchow, Schratz, and Brenning (2017).", out.width="60%", fig.scap="The Mt. Mongón study area."} | |||
knitr::include_graphics("figures/study-area-mongon.png") | |||
knitr::include_graphics("figures/15_study_area_mongon.png") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
dplyr::pull(dem) | ||
# rotating NMDS in accordance with altitude (proxy for humidity) | ||
rotnmds = MDSrotate(nmds, elev) | ||
rotnmds = vegan::MDSrotate(nmds, elev) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
library(ranger) | ||
library(sf) | ||
library(terra) | ||
library(tree) | ||
library(vegan) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need to load it if we're using it below with vegan::
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
probably not
library(progressr) | ||
library(qgisprocess) | ||
library(terra) | ||
library(tictoc) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
New dep. See geocompx/geocompkg#32
These are major changes but they are clearly good ones. I would err on the side of merging soon and tidying up early? Thoughts welcome @jannes-m and @Nowosad, there are a few suggestions in my comments above that may be worth conversation but overall pretty non-controversial stuff. Really happy to see this moving forward. |
Acutally, there shouldn't be any merge conflicts with the main branch since I harmonized with the main branch regularly but well, you never know.... |
Robin, thanks for your review! I have polished further chapters 12 and 15. And I think we can merge, and fix soon if something goes amiss as you have proposed! |
FYI: will compile the book locally and try to resolve all issues occurring in chapters 12 and 14. Will try to do so this night. |
mmh, there are still problems when trying to read mlr3 benchmark output results via |
ok, I think I have found a better solution. I will implement it in the coming days. |
Thanks for this mega PR Jannes, great to have it merged to keep the momentum going. We can do post merge fixes! @Nowosad plans to do a post merge review, should be easier with reference to the updated version online. |
Hello everyone,
in this PR I have:
To keep in mind:
mlr3::benchmark()
because it will probably take ages to finish...