R is free and powerful software for data analysis and graphics. However, its flexible approach is so different from other software that it can be frustrating to learn. This 8-hour workshop introduces R in a way that takes advantage of what you already know. For many topics we will begin with add-on commands that work similarly to your current software. Then we will cover R’s built-in commands that provide simpler but more flexible output. We will also discuss aspects of R that are likely to trip you up. For example, many R functions let you specify which data set to use in a way that looks identical to SAS, but which differs in a way that is likely to lead you to perplexing error messages.
Most of our time will be spent working through examples that you may run simultaneously on your computer. However, the handouts include each step and its output, so feel free to just relax and take notes. Most examples come from the extensive data management examples in R for SAS and SPSS Users, R for Stata Users, and http://r4stats.com. That makes it easy to review what we did later with full explanations, or to learn more about a particular subject by extending an example which you have already seen.
After each 4-hour session you will receive a set of practice exercises for you to do on your own time, as well as solutions to the problems. The instructor is available via email to address these problems or any other topics in his workshops or books.
Attendees should know how to program in SAS, SPSS or Stata and be familiar with basic statistical methods including linear regression and basic analysis of variance.
When finished, you will be able to use R to import data, transform it, create publication quality graphics, perform commonly used statistical analyses and know how to generalize that knowledge to more advanced methods. You will also have an especially thorough understanding of how R compares to SAS, SPSS and Stata.
Robert A. Muenchen is the creator of the web site http://r4stats.com and is the author of the books, R for SAS and SPSS Users, and, with Joseph Hilbe, R for Stata Users. An Accredited Professional Statistician™ with 30 years of experience, Bob is the Manager of Research Computing Support (formerly the Statistical Consulting Center) at the University of Tennessee. Bob has served on the advisory boards of SAS Institute, SPSS Inc., the Statistical Graphics Corporation and PC Week Magazine. His suggested improvements or programming code have been incorporated into SAS®, SPSS®, JMP®, STATGRAPHICS® and several R packages.
During this course we will use a combination of slides and hands-on work, running programs step by step to study their output. If you bring your laptop computer with a recent version of R and RStudio, you will be able to follow along helping you learn the software. If you instead prefer to simply watch the instructor step the programs on the projected screen, that is fine too. You can download R for free at:
You can download and install RStudio for free at:
(Data management topics are covered in a separate workshop that follows immediately after this one.)
- Introduction and statement of goals
- Overview of R
- Installing and maintaining R
- Programming Language Basics – including creating, subsetting and analyzing vectors (variables), factors (categorical variables), data frames (data sets), matrices, arrays and lists.
- Managing your files and workspace – R provides a complete environment that includes many commands for listing, printing, saving, deleting data as well as examining object structure.
- Controlling functions (procedures or commands) using arguments (options or parameters) or an object’s class; how to change class
- Data Acquisition – reading comma- and tab-delimited files, Excel, SAS, SPSS & Stata
- Data Transformations – modifying existing variables and creating new ones
- Selecting variables and observations – R offers many more ways to do selection
- Writing functions (macros)
- Traditional graphics (similar to old SAS and SPSS graphics) including bar, scatter, strop, box plots, histograms, plotting groups, adding embellishments and regression fits.
- Lattice graphics (similar to new SAS SG* and Stata graphics) – a brief overview
- The Grammar of Graphics approach using the ggplot2 package (similar to SPSS GPL) including: qplot vs. ggplot; bar charts, histograms, scatter, strip, multi-layered plots; group plots, adding embellishments and fit lines.
- Interactive graphics – a brief overview (similar to JMP, SAS/INSIGHT, SAS/IML Studio)
- Graphics resources
- Descriptive statistics done both the SAS/SPSS/Stata way and the R way
- Crosstabulation done both the SAS/SPSS/Stata way and the R way
- “By” or “split file” processing of groups
- Correcting p-values for the effects of multiple testing
- Correlation: Pearson, Spearman
- Linear regression
- Extractor functions (like Stata’s postestimation commands)
- t-test & Wilcoxon Mann-Whitney rank sum test
- Paired t-test & Wilcoxon signed-rank test
- Analysis of variance, Kruskal-Wallis & post hoc tests
- Getting publication-quality output into Word, LibreOffice, HTML and LaTeX
- Ways to run R
- Programs that include other programs
- Running R from within SAS and SPSS
- Running R as an adjunct to Stata
- Graphical User Interfaces: R Commander, JGR, Rattle, Excel
- Summary of topics learned
Here is a slide show of previous workshops.