This is an introduction to R designed for participants with no programming experience. It can be taught in 3/4 of a day (approximately 6 hours). The lesson starts with some basic information about syntax for the R programming language, the RStudio interface, and moves through to specific programming tasks, such as importing CSV files, the structure of data frame objects in R, dealing with categorical variables (i.e. factors), basic data manipulation (adding/removing rows and columns), and finishing with calculating summary statistics and a brief introduction to plotting. There is also a lesson on how to use databases from R that is intended to be taught after the SQL lesson, and ideally at the end of a Data Carpentry workshop.
The lesson assumes no prior knowledge of R or RStudio. Learners should have R and RStudio installed on their computers. They will also need to be able to install R packages from CRAN, create directories, and download files. See the lesson website for instructions on installing R, RStudio, and the required R packages.
- Before we start
- Introduction to R
- Starting with data
- Manipulating, analyzing and exporting data with
tidyverse
- Data visualization with
ggplot2
- SQL databases and R
There is a code handout that is intended to be distributed to the participants. This file includes some of the examples used during teaching and the titles of the section. It provides a guide that the participants can fill in as the lesson progresses. Participants can also source code from this file to avoid typos in more complex examples.
Contributions to the content and development of these lesson are very welcome! If you would like to contribute, we encourage you to review our contributing guide.
If you have any questions or feedback, please open an issue, contact the maintainers, or come chat with us on the Slack Channel for this lesson. If you don't already have a Slack account with the Carpentries, you can create one.
- Ana Costa Conrado
- François Michonneau
- Maneesha Sane
- Brian Seok
- Ashwin Srinath
Please cite as
François Michonneau, Tracy Teal, Auriel Fournier, Brian Seok, Adam Obeng, Aleksandra Natalia Pawlik, … Ye Li. (2019, July 1). datacarpentry/R-ecology-lesson: Data Carpentry: Data Analysis and Visualization in R for Ecologists, June 2019 (Version v2019.06.1). Zenodo. http://doi.org/10.5281/zenodo.3264888