Using R in Social Work Research
Our goal for this document is to illustrate the importance of good data analysis practices and how R and companion packages support these practices. We think the R system has many benefits for social work research. R has become the flagship computing environment for many areas of science and has great appeal because it is free and open-access. In addition, free tools like RStudio and R Markdown promote an a replication commitment and open science philosophy important to our work.
One particular strength of R is that it encourages and facilitates data sharing and replication. Through the use of R tools, social work researchers can readily share their work. Although one could argue that it is possible to encourage replication using popular statistical packages (e.g., SPSS, Stata, SAS, MPlus, EQS) by sharing relevant code or syntax and data files, the fact that they are propriety may limit replication efforts. Using R, any researcher has free and open access to the statistical methods used in a study and can easily do replications. In addition, RStudio and R Markdown make sharing both original research and replication studies accessible.
In the five following chapters, we discuss how R and various packages can be used to support our research work. The chapters are:
- Survey Research
- Intervention Research
- Confirmatory Factor Analysis
- Structural Equation Modeling
- Item Response Theory
To access and use R and RStudio follow these steps:
- Download and install the R version for your platform, e.g., Mac, Windows, or Linux. This link https://www.r-project.org/ will take you to the R homepage – follow installation directions found there.
- Download and install the RStudio version for your platform. This link https://rstudio.com/ will take you to the RStudio homepage where you will find instructions about how to download the free program.
- Start your work with R by opening RStudio. It is a complete interface to the R computing environment with a number of helpful tools to support R programming. We urge new users to take advantage of the extensive user group and internet help available for both R and RStudio.
The first step in using R is to identify the packages you will need for various statistical tests and graphic presentations. A strength of R is that there are literally thousands of packages available for virtually any statistical need you might have – a challenge in using R is that there are thousands of packages for you to navigate. With some patience and the availability of a broad R support community, you should soon find the handful of packages useful for your work.
If you are interested in R after reading this document, feel free to contact Jerry Bean (firstname.lastname@example.org) for more information. It has become his (my) mission to encourage the use of R in social work doctoral training and social work research, in general.