#
Moving from IBM® SPSS® to R and RStudio®
A Statistics Companion

- Howard T. Tokunaga - San Jose State University, USA

**Other Titles in:**

Computer Skills | Research Methods in Psychology | Statistical Computing Environments

March 2021 | 312 pages | SAGE Publications, Inc

Are you a researcher or instructor who has been wanting to learn R and RStudio®, but you don't know where to begin? Do you want to be able to perform all the same functions you use in IBM® SPSS® in R? Is your license to IBM® SPSS® expiring, or are you looking to provide your students guidance to a freely-available statistical software program?

**is a concise and easy-to-read guide for users who want to know learn how to perform statistical calculations in R. Brief chapters start with a step-by-step introduction to R and RStudio, offering basic installation information and a summary of the differences. Subsequent chapters walk through differences between SPSS and R, in terms of data files, concepts, and structure. Detailed examples provide walk-throughs for different types of data conversions and transformations and their equivalent in R. Helpful and comprehensive appendices provide tables of each statistical transformation in R with its equivalent in SPSS and show what, if any, differences in assumptions factor to into each function. Statistical tests from**

Moving from IBM® SPSS® to R and RStudio®: A Statistics CompanionMoving from IBM® SPSS® to R and RStudio®: A Statistics Companion

*t*-tests to ANOVA through three-factor ANOVA and multiple regression and chi-square are covered in detail, showing each step in the process for both programs. By focusing just on R and eschewing detailed conversations about statistics, this brief guide gives adept SPSS® users just the information they need to transition their data analyses from SPSS to R.About the Author

Acknowledgments

Introduction

Chapter 1. Introduction to R

1.1 What Is R?

1.2 Why are Some Features of R?

1.3 Installing R and Getting Help Learning R

1.4 Conducting Statistical Analyses in Spss Versus R: A First Example

1.5 Comparing Spss and R

Chapter 2. Preparing to Use R and Rstudio

2.1 Tasks to Perform Before Your First R Session

2.2 Tasks to Perform Before Any R Session

2.3 Tasks To Perform During Any R Session

Chapter 3. R Terms, Concepts, and Command Structure

3.1 Data-Related Terms

3.2 Command-Related Terms

3.3 Object-Related Terms

3.4 File-Related Terms

Chapter 4. Introduction to Rstudio

4.1 What Is RStudio?

4.2 Installing RStudio

4.3 Components of RStudio

4.4 Writing and Executing R Commands in RStudio

Chapter 5. Conducting Rstudio Sessions: A Detailed Example

5.1 1. Start RStudio

5.2 2. Create a New Script File (Optional)

5.3 3. Define the Working Directory

5.4 4. Import CSV File to Create a Data Frame

5.5 5. Change Any Missing Data in Data Frame to NA

5.6 6. Save Data Frame With NAs As CSV File in the Working Directory

5.7 7. Read the Modified CSV File to Create a Data Frame

5.8 8. Download and Install Packages (If Not Already Done)

5.9 9. Load Installed Packages (As Needed)

5.10 10. Conduct Desired Statistical Analyses

5.11 11. Open a New Markdown File

5.12 12. Copy Commands and Comments into the Markdown File

5.13 13. Knit the Markdown File to Create a Markdown Document

5.14 Exiting Rstudio (Save the Workspace Image?)

5.15 Getting Help With R

Chapter 6. Conducting Rstudio Sessions: A Brief Example

6.1 1. Start RStudio

6.2 2. Create a New Script File (Optional)

6.3 3. Define the Working Directory

6.4 4. Import CSV File to Create a Data Frame

6.5 5. Change Any Missing Data in Data Frame to NA

6.6 6. Save Data Frame with NAs as CSV File in the Working Directory

6.7 7. Read the Modified CSV File to Create a Data Frame

6.8 8. Download and Install Packages (If Not Already Done)

6.9 9. Load Installed Packages (As Needed)

6.10 10. Conduct Desired Statistical Analyses

6.11 11. Open a New Markdown File

6.12 12. Copy Commands and Comments into the Markdown File

6.13 13. Knit the Markdown File to Create a Markdown Document

6.14 Exiting RStudio

Chapter 7. Conducting Statistical Analyses Using This Book: A Detailed Example

7.1 1. Start RStudio

7.2 2. Copy and Paste an Example Script into a Script File

7.3 3. Modify the Example Script as Needed for the Desired Statistical Analysis

7.4 4. Execute the Script to Confirm It Works Properly

7.5 5. Copy and Paste the Script into a Markdown File

7.6 6. Knit the Markdown File to Create a Markdown Document

Chapter 8. Conducting Statistical Analyses Using This Book: A Brief Example

8.1 1. Start RStudio

8.2 2. Copy and Paste an Example Script into a Script File

8.3 3. Modify the Example Script as Needed for the Desired Statistical Analysis

8.4 4. Execute the Script to Confirm it Works Properly

8.5 5. Copy and Paste the Script into a Markdown File

8.6 6. Knit the Markdown File to Create a Markdown Document

Chapter 9. Working With Data Frames and Variables in R

9.1 Working with Data Frames

9.2 Working With Variables

Chapter 10. Conducting Statistical Analyses Using SPSS Syntax

10.1 Conducting Analyses in SPSS Using Menu Choices

10.2 Conducting Analyses in Spss Using Syntax Commands

10.3 Editing SPSS Output Files

Appendix A: Data Transformations

Reverse Score a Variable (Recode)

Reduce the Number of Groups in a Categorical Variable (Recode)

Create a Categorical Variable from a Continuous Variable (Recode)

Create a Variable from Other Variables (Minimum Number of Valid Values) (Compute)

Create a Variable from Occurrences of Values of Other Variables (Count)

Perform Data Transformations When Conditions are Met (IF)

Perform Data Transformations Under Specified Conditions (DO IF/END IF)

Perform Data Transformations Under Different Specified Conditions (DO IF/ELSE IF/END IF)

Use Numeric Functions in Data Transformations (ABS, RND, TRUNC, SQRT)

Appendix B: Statistical Procedures

Descriptive Statistics (All Variables)

Descriptive Statistics (Selected Variables)

Descriptive Statistics (Selected Variables) by Group

Frequency Distribution Table

Histogram

t-Test for One Mean

Confidence Interval for the Mean

T-Test for Independent Means

T-Test for Dependent Means (Repeated-Measures T-Test)

One-Way Anova and Tukey Post-Hoc Comparisons

One-Way Anova and Trend Analysis

Single-Factor Within-Subjects (Repeated Measures) Anova

Two-Factor Between-Subjects Anova

Two-Factor Between-Subjects Anova (Simple Effects)

Two-Factor Between-Subjects Anova (Simple Comparisons)

Two-Factor Between-Subjects Anova (Main Comparisons)

Two-Factor Mixed Factorial Anova

Two-Factor Within-Subjects Anova

Three-Factor Between-Subjects Anova

Pearson Correlation (One Correlation)

Pearson Correlation (Correlation Matrix)

Scatterplot

Internal Consistency (Cronbach’s Alpha)

Principal Components Analysis (Varimax Rotation)

Principal Components Analysis (Oblique Rotation)

Factor Analysis (Principal Axis Factoring)

Linear Regression

Multiple Regression (Standard)

Multiple Regression (Hierarchical With Two Steps)

Multiple Regression (Hierarchical With Three Steps)

Multiple Regression (Testing Moderator Variables Using Hierarchical Regression)

Multiple Regression (Portraying A Significant Moderating Effect)

Multiple Regression (Stepwise)

Multiple Regression (Backward)

Multiple Regression (Forward)

Canonical Correlation Analysis

Discriminant Analysis (Two Groups)

Discriminant Analysis (Three Groups)

Cross-Tabulation and the Chi-Square Test of Independence

Further Resources

### Supplements

Student Study Site

Visit the companion website to download data files and code to accompany this book.

Visit the companion website to download data files and code to accompany this book.