Throughout much of this course, R will be used as an analysis platform on which we can perform ecological and genetic analyses. R is a general purpose analysis language that can be used to analyze a wide host of problems. This tool is made more effective due to its openness (it is released under an open source license), its expandability (the general public can add data types, functions, and analyses), and its availability (it is available free of charge).
All lab materials can now be previewed on bookdown.org: https://bookdown.org/hhwagner1/LandGenCourse_book.
Index of packages: you can now check which R package is used in which worked example. This provides a quick way of finding relevant materials when for a specific topic: https://bookdown.org/hhwagner1/LandGenCourse_book/list-of-packages.html.
An R package has been specifically developed for this course by Helene Wagner.
Initial installation: please follow the instructions listed here:
Getting help: If at any point you encounter problems using R or the 'LandGenCourse' package, please send an inquiry to landgencourse.help@gmail.com (the help email is only available January - May 2024).
Below is the code for updating the R package 'LandGenCourse':
remotes::install_github("hhwagner1/LandGenCourse")
library(LandGenCourse
R is likely to ask you whether you want to update several packages. If it fails with 'yes' or 'all' etc., try 'none'.
If you are having issues installing the LandGenCourse package, please verify that you have the most recent version of R and RStudio on your computer.
If working on a Mac, you must install Xquartz first. This must be installed again after each MacOS update.
Install package 'remotes' first.
The initial installation may take several minutes as required packages need to be installed. Updates will be much quicker.
At the beginning of the installation process, and especially if you are updating LandGenCourse, R is likely to ask you whether you want to update several packages. If it fails with 'yes' or 'all' etc., try 'none'
Sometimes, a call to library(LandGenCourse) will fail to add the Addins in RStudio. Simply run the two lines again (should be fast the second time):
remotes::install_github("hhwagner1/LandGenCourse")
library(LandGenCourse)
With a little patience and some perseverance, the following procedure should fix most issues. This may take 20 - 60 min depending on how much manual installation is required.
Throughout the installation process, you may receive error messages indicating specific packages (i.e., dependencies) failed to load properly.
At the end, R will tell you which packages did not install. These package will need to be installed manually using the install.packages() function, or using the Tools drop-down menu in RStudio (Option: Install packages…).
You may also be asked to update packages. If this happens, please follow the instructions and update them. You may have to do this multiple times.
You may be asked whether you want to install from source code. Ok to type "no". This will install from binaries (already compiled code), which is faster.
If the installation stops with an error "API rate limit exceeded", the best thing to do is to wait 30 min and run the Addin "0. Install Packages" again. Don’t worry, this won’t start the installation process again, it will resume where it broke off.
Another thing that could happen is that the installation process for the packages times out. Run the installation again, it will continue and you'll make it through eventually.
Lastly, you may need to restart your RStudio session or restart your computer for the updates to take effect.
We fixed some issues with the Swirl tutorials on Jan 28. If you started using the swirl tutorials before, and you are getting errors, please do the following:
Uninstall the swirl course in RStudio: swirl::uninstall_course("Landscape_Genetics_R_Course")
Start swirl again (use the Addin for the interactive tutorials) and use a different name than before.
There may be problems with the package gstudio not being installed. If that is the case, run the following chunk of code first:
if(!requireNamespace("popgraph", quietly = TRUE))
{
install.packages(c("RgoogleMaps", "geosphere", "proto", "sampling", "seqinr",
"spacetime", "spdep"), dependencies=TRUE)
remotes::install_github("dyerlab/popgraph")
}
if(!requireNamespace("gstudio", quietly = TRUE)) remotes::install_github("dyerlab/gstudio")
If you are still having problems installing the course packages after working through this process, please contact the tech support email: landgencourse.help@gmail.com.
The lab materials, including the LandGenCourse package and tutorial videos, are meant to provide you with flexible learning options. Depending on your background and learning objectives, the material can be used in various ways to suit your specific needs (click on figure to enlarge). See also here: https://bookdown.org/hhwagner1/LandGenCourse_book/how-to-use-this-book.html.
A recorded lab review will be posted one week after the corresponding lecture.
Below are links to videos that introduce some of the datasets used in the LandGenCourse package.
Columbia spotted frog dataset (Dr. Melanie Murphy) (link updated Jan 19, 2022)
Freshwater snail metapopulation dataset (Dr. Thomas Lamy)
Calcareous grassland plant (Dianthus) dataset (Dr. Yessica Rico)
The following links provide videos that introduce the use of R studio, the LandGenCourse package, and R Notebooks:
Interactive swirl courses found here may be useful if you are new to R
Applied population genetics by Dr. Rodney Dyer
Population genetics and genomics in R by Grünwald et al.