Welcome to the Jornada Environmental Data Science education site (JEDS!). Our aim is to teach introductory and intermediate elements of data science (data management, analysis, statistics, visualization, etc.) to Jornada researchers using open-source software tools, and real data from the Jornada.
R
lessonMany JEDS tutorials use the R
programming language, and additional packages from the R software
ecosystem, as the primary software tools, especially for statistical
analysis. During R
-based JEDS workshops we teach using the
RStudio development environment
as our primary programming and analysis environment. For working through
these tutorials, either on your own or in a workshop, you should have
both installed according to the instructions below.
The section below borrows heavily from the “Data Carpentry: Data Analysis and Visualization in R for Ecologists” lesson (Eunice, 2022)
R and RStudio are two separate pieces of software:
If you don’t already have R and RStudio installed, follow the instructions for your operating system below. You have to install R before you install RStudio.
.exe
file that was just downloaded.pkg
file for the latest R versionsudo apt-get install r-base
, and for Fedora
sudo yum install R
), but we don’t recommend this approach
as the versions provided by this are usually out of date. In any case,
make sure you have at least R 3.3.1.sudo dpkg -i rstudio-YYYY.MM.X-ZZZ-amd64.deb
at the
terminal).If you already have R and RStudio installed, first check if your R version is up to date:
sessionInfo()
into the console. If your R version is 4.0.0
or later, you don’t need to update R for this lesson. If your version of
R is older than that, download and install the latest version of R from
the R project website for Windows, for MacOS, or for LinuxTools > Global Options > General > Basic
.installr
that can help you with upgrading your R
version and migrate your package library.To update RStudio to the latest version, open RStudio and click on
Help > Check for Updates
. If a new version is available
follow the instruction on screen. By default, RStudio will also
automatically notify you of new versions every once in a while.
R
packagesDuring the course we will need a number of R packages. Packages
contain useful R code written by other people. In most workshops we will
use the packages tidyverse
, nlme
,
lme4
, and emmeans
.
To install these packages, open RStudio and copy and paste the following command into the console window (look for a blinking cursor on the bottom left), then press the Enter (Windows and Linux) or Return (MacOS) to execute the command.
install.packages(c("tidyverse", "nlme", "lme4", "emmeans"))
Alternatively, you can install the packages using RStudio’s graphical
user interface by going to Tools > Install Packages
and
typing the names of the packages separated by a comma.
R tries to download and install the packages on your machine. When the installation has finished, you can load the packages by pasting the following code into the console:
library(tidyverse)
library(nlme)
library(lme4)
library(emmeans)
If you do not see an error like
there is no package called ‘...’
you are good to go!
NOTE that if you are attending a workshop, you will likely receive additional instructions about packages required for for your workshop. It is a good idea to install these in advance, using commands like those above, and let your instructors know if you have any problems.
Generally, it is recommended to keep your R version and all packages
up to date, because new versions bring improvements and important
bugfixes. To update the packages that you have installed, click
Update
in the Packages
tab in the bottom right
panel of RStudio, or go to
Tools > Check for Package Updates...
.
Sometimes, package updates introduce changes that break your old
code, which can be very frustrating. To avoid this problem, you can use
a package called renv
. It locks the package versions you
have used for a given project and makes it straightforward to reinstall
those exact package version in a new environment, for example after
updating your R version or on another computer. However, the details are
outside of the scope of this lesson.
We will download the data directly from R during the lessons. However, if you are expecting problems with the network, it may be better to download the data beforehand and store it on your machine.
The data files for the lesson can be downloaded manually here: https://doi.org/10.6084/m9.figshare.1314459
A copy of all data files used in these lessons are stored in the
data/
directory of the GitHub repository. The data files
you need for lessons will be specified at the start of the lesson
materials, and you may also receive additional information from
instructors before for workshops.
git
and GitHub lessonsgit
is a distributed
version control system and is the underlying technology behind GitHub, the web-based software development
and collaboration platform. It is common to use git
together with a “shell”, which is a command-line interface to your
computer. So, for JEDS tutorials that involve git
and
GitHub, please complete three steps using the recommended resources:
git
to your computerIf you are on MacOS or Linux, you should have a shell installed
already, just make sure you can open it. For Windows you can install
git
and the bash
shell together. There are two
good resources for getting git
and related software ready
for a one of the JEDS tutorials.
git
installation instructions gives succinct
platform-based instructions.If you want, you can also install a GUI client for git
to help visualize and manage what is happening with repositories you are
working with. A few recommended clients are GitKraken, SourceTree, and GitHub Desktop. More discussion
of clients is available over at Happy Git with
R.
These workshops are based on “live coding,” so instructors will be running example R code while learners are expected to follow along on their own machine. To follow along successfully during a JEDS workshop, please ensure you have a laptop or other Windows, MacOS, or Linux device that has R and RStudio, and any necessary R packages, installed and up to date. Look for instructions provided by instructors in advance of the workshop about what R packages to install, and any other materials you may need to download or bring. Also, always bring a charger for your device.
If the workshop is in a virtual format we will be using the Zoom platform, so make sure you have Zoom installed and up-to-date on your machine as well.