Introduction to R for Clinical Psychology

Author

Christopher J Wilson

Published

December 12, 2024

Welcome

The purpose of this site/book is to introduce you to R and R Studio for use in Clinical Psychology Research. Before you begin, there are some important things to know:

  1. This site is not a comprehensive guide to everything that can be done in R. There are many resources available for learning R, and this site is just a starting point. It will cover the basics of R and R Studio, and will provide examples of how to use R for common tasks in clinical psychology research.

  2. This site is not a comprehensive guide to statistics. It will cover some key statistical concepts and how to perform them in R, but it is not a compete substitute for a statistics textbook or course. The goal of this content is to cover some key statistical concepts that are pertinent to clinical psychology research. It is expected that you have some background in statistics, and that you are familiar with basic concepts such as hypothesis testing, p-values, and confidence intervals.

  3. It is important to note that R is a powerful tool, but it can be complex and challenging to learn. It is normal to feel overwhelmed at times, and it is important to be patient with yourself as you learn. The more you practice and use R, the more comfortable you will become with it. Set your expectations accordingly, and remember that learning R is a process that takes a long time and should continue throughout your career. This is just your starting point.

  4. This site is a work in progress. I am constantly updating, adding new content and removing some less useful elements, so please check back regularly for updates. If you have any feedback or suggestions for content, please let me know.

The tidyverse

This site/book uses the tidyverse set of packages

The tidyverse is a collection of R packages designed for to make data manipulation and visualization. easier in R. The tidyverse is a powerful set of tools for data analysis, and it is widely used in the R community. It is assumed that you will have the tidyverse installed and loaded for the examples in this site/book. If you do not have the tidyverse installed, you can install it by running the following code in the R console:


install.packages("tidyverse")

You only need to install the package on to your machine once. Once you have installed the tidyverse, you can load it by running the following code in the R console:


library(tidyverse)

The library() function is used to load packages in R. You will need to load the tidyverse package at the beginning of each R session in which you want to use it.

Textbooks that can be accessed online

e-books can be accessed from the library website: https://www.tees.ac.uk/depts/lis/

Research Methods and Statistics

Coolican, 2019. Research Methods and Statistics in Psychology. Taylor & Francis Group

Barker, C., Pistrang, N., & Elliott, R. (2015). Research methods in clinical psychology: An introduction for students and practitioners (3rd ed.). Chichester, West Sussex: Wiley Blackwell.

Weiner, I. B., Schinka, J. A., & Velicer, W. F. (2012). Handbook of psychology, research methods in psychology (2. Aufl. ed.). Somerset: Wiley.

Working with R and RStudio to do analysis

Navarro, D. (2017) Learning statistics with R.

Phillips N. D. (2018) YaRrr! The Pirate’s Guide to R

Horton, Pruim and Kaplan (2015) A Student’s Guide to R

Mather, M. (2019) R for Academics

Wickham and Grolemund (2019). R For Data Science

Allaire and Grolemund (2019). R Markdown: The Definitive Guide

Basics of RStudio

Data Import

Data Transformation

Data Visualisation with GGPlot