R and R Commander plus IPSUR Tutorial

- G. Andy Chang & G. Jay Kerns


1.     Download/Install R and R Commander


·       Click here to download a Ready-To-Use R and R Commander+IPSUR software (R.zip file) for Windows only (YouTube Video Instruction) (Download and unzip this R.zip file, version 3.5.1. Please run the Rgui.exe file, in R/bin/i386 folder, to start R program and create a short cut to it. This is for beginners or students who are not comfortable with the software installation. The best way to install R software is installing the latest version as shown in the following link.)

o   Download R 3.4.4 .zip (This is a zip version prior to version 3.5.1.)

·       Instruction for Installing R for Mac and Windows users:

o   Instruction For Windows Users: http://gchang.people.ysu.edu/r/Install R Software Windows.pdf

o   Instruction For Mac Users: http://gchang.people.ysu.edu/r/Install R Software Mac.pdf

·       Click here for instructions on installing R and R Commander+IPSUR for Windows, Mac, and Linux


Other useful information:

o   R Commander Installation Notes for PC/Mac/Linux (Mac users should read this if having problems setting up R Commander.)

o   A fix for can not see the list of options in dropdown menu when using Mac to run R Command (YouTube).

o   A YouTube Video Tutorial for Downloading and Installing R for Windows

o   YouTube Video on R Commander Demo Part 1

o   YouTube Video on R Commander Demo Part 2


2.     R and R Commander References


R Commander Reference:

·        Instructions for Using R Commander with IPSUR - G. Andy Chang & G. Jay Kerns

·        Getting Started With R Commander - John Fox

·        R Commander Introduction - Natasha Karp


        R Code Reference:

·        http://www.r-tutor.com/elementary-statistics - R Tutorial: Reference for R codes

·        http://www.statmethods.net/index.html - Quick-R: Reference for R codes

·        http://ggplot2.org/ - ggplot: R graphics package

·        Examples of Basic R Codes for Descriptive Statistics

·        https://cran.r-project.org/doc/contrib/Seefeld_StatsRBio.pdf - Using R with Biological Examples



3.     R Commander Instructions

(Some of the instruction materials were made based on R version 2.*.*. The newer edition of R Commander moved some of the options into additional Option tab.)


How to Start R Commander with IPSUR Plugin (Video) (YouTube)

How to set to SDI window environment [text]


Data Processing

Import Excel File (Video) (YouTube) [Example Excel data: example.xlsx ; example.xls]

Create a New R Data file using R Code [text] (A way to create new data in Mac version of R Commander)

Create Data Frame and Use Editor [text] (Another way to create new data in Mac version of R Commander)

Converting to Factor Variable (Video) (YouTube) [Example R data: Practice.rda]

Converting Factor Variable to Numeric Variable [text]

Compute New Variable (Video) (YouTube) [BMI Example R data: Practice1.rda]

Recode a Numeric Variable to a Factor or Numeric Variable (YouTube)

Create a Subset of a Data Set by Removing Varibles using R Subset Function (YouTube)

Create a Subset of a Data Set by Removing Cases (YouTube)


Descriptive Statistics

One Qualitative Variable

Making a Bar Chart (Video) (YouTube) [Example R data: Practice1.rda]

Bar Chart & Pie Chart [text]


Insert R Graph into Word Document (Video) (YouTube) [Example R data: Practice1.rda]


One Quantitative Variable

Histogram (Video) (YouTube) [Example R data: Practice1.rda]

-    Produce histogram and re-label the x and y axis

Normality Tests (Video) (YouTube) [Example R data: Practice1.rda]

-    Normality test for one variable and its subgroups

Histogram, Stem Plot & Strip Chart [text]

Quantile-comparison Plot & Normality Test [text]

Normality Tests for Subgroups [text]

Box Plot and Side-by-side Box plot [text]


Relation between Two Qualitative Variables

      Contingency Table [text]


Relation between Two Quantitative Variables

      Scatter Plot [text]


Display Time Sequence Data

      Line Graph [text]



Binomial [text]

Hypergeometric [text]

Negative Binomial [text]

Geometric [text]

Poisson [text]

Exponential [text]

Normal Probability [text]

Chi-squared Quantile or Critical Value [text]


Statistical Inference [Test of statistical hypotheses and confidence intervals]

One Sample Inference for Mean

One Sample t-Test [text]

Compute p-value for t-Test (Video)


Two Samples Inference

Paired Sample T-Test and Confidence Interval for Mean Paired Difference (YouTube)

Paired Sample t-Test [text]

Two Independent Sample t-Test [text]

Test of Equality of Variances [text]

·        Confidence Interval Estimate for Variance [text]



One Way ANOVA F-test (Video) (YouTube)

One-way ANOVA [text]

Compute p-value for ANOVA F-Test (Video)


Inference on Proportions

Confidence Interval for One Proportion (YouTube)

Hypothesis Test for One Proportion, Two-Sided and One-Sided test (YouTube)

Tests of One Proportion & Equality of Two Proportions [text]


Contingency Table Analysis for Categorical Data

Chi-Square Test for Independence with Raw Data (Video) [The convert numeric variable to factor option in Data Editor is not available in the new version of R Commander. You need to use the Data option to do it.]

Chi-Square Test for Independence with Organized Data (Video)

Chi-square Test for Independence [text]

MacNemar Test example output [text] [R code, R Document]

Mantel-Haneszel Test example output [text] [R code, Reference link for R code]


Nonparametric Tests

Signed Rank Test for One Sample (Video) (YouTube)

Signed Rank Test for Paired Sample (Video) (YouTube)

Wilcoxon Rank Sum Test/Two Independent Samples Test (Video) (YouTube)

Kruskal Wallis Test/One Way ANOVA Test (Video)


Correlation and Regression

Simple Linear Regression (Video) [Example R data: WeightAgeHeight.RData]

Multiple Regression part 1: Model Building and Diagnostics (Video)

Multiple Regression part 2: Prediction Interval (Video) [R code]

Compute and Test for Linear Correlation & Linear Regression [text]


Logistic Regression

Logistic Regression part 1: Model Setup and Building (Video) (YouTube) [Data: Logistic.RData]

Logistic Regression part 2: Probability Prediction (Video) (YouTube) [R code]

Hosmer-Lemeshow test (Video) (YouTube) [R code]

·        Create File that Contains No Missing Data [text] (If you see the following Error message "missing values and NaN's not allowed if 'na.rm' is FALSE" when using Hosmer-Lemeshow test package, it may because you have missing data in the variables used for logistic regression. Use this action to generate a data file without missing data for the response and explanatory variables in a logistic regression should fix the problem when using logitgof function in generalhoslem.)


Survival Analysis

Survival Analysis: Compare Survival Functions and Cox Regression



Any questions and comments please contact Andy Chang at gchang@ysu.edu