The aim of this course is to give an introduction to R addressed to people that have never used R. By the end of the course, the participants should be able to do the following in R:
- Import / export data-bases.
- Manage data sets.
- Carry out basic statistic analyses with R.
- Draw high quality graphs.
- Program specific functions.
Guided practice with R – Students are encouraged to bring a dataset with them along with a “previously completed” statistical analysis or graphic. Ideally something fairly introductory and simple from the student’s own field of practice that you’ve worked with in Excel, SAS, or elsewhere. We will use the last lesson session to review all the steps to ensure students can load, check, tidy data and then perform the basic statistics or generate the graphs common in their respective disciplines. This time also usually provides an opportunity to troubleshoot and learn to navigate web resources to find solutions to errors. Extra datasets will be available for students that prefer not to bring their own work or who want extra practice at specific skills.
All participants must bring their own personal laptop (Windows, Macintosh) with current versions of R and R Studio pre-installed. If you have any problem installing them, please contact the course coordinator.
- Orientation to R and R Studio.
- Introduction to R programming language.
- Basic data objects: Values, vectors, data frames, lists.
- Programming syntax.
- Packages and libraries.
- Working directory and environments.
- Comments, indents, and other good practice.
- Loading data into R.
- Reading xlsx, txt, and csv files.
- Quick summary commands to check data quality.
- Quick plot commands to check data quality.
- Reproducible Research Methods in R.
- Orientation to R Markdown.
- Exercise: Load and tidy some data within R Markdown.
- Restructuring data.
- Adding, deleting, renaming variables.
- Changing long to short format (and vice versa).
- Joining data frames.
- Subsetting data.
- Conditional programming.
- Logical operators.
- If else statements.
- For loops.
- Exercise: Load and tidy a species and a habitat dataset, join to create a single species-habitat dataframe, then split into four tables by taxa.
- Plotting with ggplot2.
- Brief intro to base and lattice as plotting alternatives.
- Overview of common specialize plotting packages.
- Overview of ggplot2 graphic concepts and syntax.
- Creating and customizing plots.
- Adjusting labels, colors, and shapes.
- Using groups and handling legends.
- Integrate data from multiple sources.
- Handling data from spatial data objects.
- Load and view a raster data file.
- Load and view a vector data file.
- Summarize and manipulate the data frame component of spatial data object.
- Export updated spatial data frame.
- Exercise: Load a spatial polygon dataset, explore data and generate summary graphs of data, modify dataframe within spatial data object.
- Exploratory data analysis with R.
- Regression packages and simple procedures.
- Clustering packages and simple procedures.
- Probability distributions.
- Writing custom functions.
- Exercise Option 1A: Load and tidy a dataset, perform an unsupervised and supervised clustering.
- Exercise Option 1B: Load and tidy a dataset, perform linear regression and ANOVA.
- Exercise 2: Change your code from exercise 1 into a custom function.
- How to build your R skills.
- Using R help, Google, and other online resources.