Key Points
The Case for Switching
- R is free, open-source, and runs on any operating system
- R scripts make your analysis fully reproducible
- R can pull data from APIs, create interactive visualizations, and automate reports, which SPSS cannot do
- Switching builds on your existing statistical knowledge rather than replacing it
Your First R Session
- RStudio is your workspace, combining a script editor, console, and data viewer
-
haven::read_sav()imports SPSS files directly, preserving labels -
readxl::read_excel()reads Excel files and can target a named sheet -
summary(),table(), andstr()replace the Descriptives and Frequencies menus in SPSS - A character column full of number-looking values is R refusing to lie to you about the data
Data Manipulation
- dplyr verbs (
filter,select,mutate,arrange,summarise) replace SPSS menu operations - The pipe operator
|>chains operations together, making code readable -
group_by()combined withsummarise()replaces SPSS Split File + Aggregate - The mean of a TRUE/FALSE column is a proportion, which saves you building dummy variables
- Keep an explicit Unknown category rather than dropping incomplete rows
Visualization with ggplot2
- ggplot2 builds plots in layers: data, aesthetics, geometry, labels, theme
- Every SPSS Chart Builder chart has a ggplot2 equivalent that offers more control
-
position = "fill"turns counts into proportions, which is usually the honest comparison - Highlight specific cases by layering a second
geom_point()over a grey base - Faceting (
facet_wrap,facet_grid) creates small multiples, which SPSS Chart Builder handles poorly
Statistical Analysis in R
- Every SPSS statistical test has a direct R equivalent, usually in a single function call
- R output is more compact than SPSS, and
broom::tidy()converts it to a clean table - Use
chisq.test()on a crosstab when both variables are categorical - A non-significant predictor is a result; do not drop terms to make the table look better
- Every row you filter out is a methods sentence you owe the reader
- Rank variables invert the sign of a coefficient, so say what direction means
Reproducible Reporting
- R Markdown combines your analysis and write-up in a single document
- When data changes, re-knitting updates every table and figure automatically
- You can output to Word, PDF, or HTML from the same source file
- Inline R code puts computed numbers inside your sentences, so text and results cannot drift apart
- Write your caveats into the code that produces them, so they travel with the number
- Parameterise a report and one file serves every subgroup in your data
- Make the data file a parameter too, and a new release of the data is one changed line
- Check what your
.defaultbranch caught every time the data changes
Where to Go from Here
- R has a large, active community, so you are never stuck alone
-
cbsodataRandWDIpull Dutch Caribbean data directly into R - Country coding schemes differ between sources, and that is where most joins break
- A stopword list is an analytical choice; publish it with your results
- Save your analyses as scripts and build a personal reference library
- The DCDC Network is your regional peer community for continued learning