Introduction to R#
Course Description#
R is a programming language and software environment primarily focused on performing statistics, data analysis and visualisation. This course will provide an all-purpose introduction to the R programming language and may provide an accessible entry to computer programming in general. Throughout the workshop participants will be taught using RStudio, and will be introduced to best practices from the beginning, including how to document your work in a script. Over three sessions you will learn how to import, manage and process data for statistical analysis and visualisation. At the end of the workshop the participants will have a solid understanding of how to run R commands and the properties of R objects, providing a solid basis for self-guided learning of more complex analyses.
Course Objectives#
Learn how to use Rstudio to write scripts and run R commands.
Learn the different types of objects for storing data and the importance of different data types.
Know how to read in data, manipulate it and save the output.
Know how to visualise data in commonly used figures.
Understand how to perform some basic inferential statistical tests.
Learn definitions of fundamental programming terminology and concepts such as variable, function and for loops that are transferable to other programming languages.
Pre-requisite Knowledge#
This is a course for novices so there is no pre-requisite knowledge.
Sign-up#
To check for upcoming course dates and to register, please visit the Workshop Schedule and Sign-up page available here.
Installation Guide#
All CfRR courses require attendees to use their own computer/laptop to follow workshop activities and take effective notes.
Because R and RStudio work together, you need to install them both. The steps in this section should guide you through the process. Once installed, you will be working with RStudio and R will be running in the background. If you are using a University of Exeter Windows machine there is the option to install with the Company Portal software if you are having issues with admin rights. You shuold be able to search for R/Rstudio and install it as per the instructions on the University website.
How to Install R?#
Installing R in 5 steps:
Step 1. Go to: https://www.r-project.org/
Step 2: Click on CRAN or download R.
Note: You’ll only do this once, although, eventually you’ll have to update to the most recent version. Follow the same procedure as today.
Step 3. Select a mirror. A Mirror is a server somewhere in the world with a copy of the program. Choose the mirror closest to you. For example, if you are in the UK, you can select the one from University of Bristol. Don’t worry too much about this.
Step 4. Select the download appropriate for your computer (Microsoft, Mac or Linux)
Step 5. Open the program you downloaded and follow the instructions
Note - There is another tutorial identical to this one that shows the process you need to follow if you have a mac.
How to Install RStudio?#
Yes, you need to install both R and RStudio. Follow this four steps:
Step 1: Go to: https://www.rstudio.com/products/rstudio/download/
Step 2: Click on the free version Download button.
Step 2 Select your download accordingly.
Step 3 Click on the download and follow the installation instructions.
Self Study Material Link#
The self-study material for this course is available here.
Acknowledgements#
Inspired by and adapted from:
John Blischak, Daniel Chen, Harriet Dashnow, and Denis Haine (eds): “Software Carpentry: Programming with R.” Version 2016.06, June 2016, swcarpentry/r-novice-inflammation, 10.5281/zenodo.57541.
Jenny Bryan: https://jennybc.github.io/purrr-tutorial
Manuel Gimond: https://mgimond.github.io/ES218/Week02a.html
Damaris Zurell (Ecology & Macroecology Lab, Univ. Potsdam 2020-2022): https://damariszurell.github.io/EEC-R-prep/index.html
Developers#
This workshop was developed by Laura Roldan Gomez, Rebecca Smith, Theresa Wacker, Emma Walker and Fiona Warren.
License Info#
Instructional Material
The instructional material in this course is copyright © 2024 University of Exeter and is made available under the Creative Commons Attribution 4.0 International licence (https://creativecommons.org/licenses/by/4.0/). Instructional material consists of material that is contained within the “individual_modules/introduction_to_r” folder in this repository, with the exception of code snippets and example programs found in files within these folders. Such code snippets and example programs are considered software for the purposes of this licence.
Software
Except where otherwise noted, software provided in this repository is made available under the MIT licence (https://opensource.org/licenses/MIT).
Copyright © 2024 University of Exeter
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
The software in this repository is adapted from software that is covered by the following copyright and permission notice:
Copyright © 2024 Software Carpentry
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.