Epidemiology     Biostatistics     Genetic Epidemiology     Population Genetics    Genome Biology    Genetics     Glossary    Homepage

  

 

Using R for Statistics and Graphics

 

Mehmet Tevfik DORAK, MD, PhD

 

This is the website of a one-day course first ran in Istanbul in 2019 on basic statistics and graphics with R. The course was designed to address the needs of absolute beginners to use R (R Users) rather than for those who want to write their own code (developers/programmers). Anyone who has an interest in learning how to use R and/or statistics should benefit. The course teaches R and statistics at the same time without assuming any prior knowledge. It can be used like a self-paced course by any learner. All presentations and R scripts are provided below. In February 2021, these sessions were delivered online at Kingston University London (KUL) and video recordings are available to those who have access to KUL network. During the course, all participants started running R codes within the first 10 minutes without any difficulty. The aim is to bring the participants to a level to enable them to use any cookbook to do most of the basic statistical tests and produce graphics. The course showed that even with a few hours of training, everybody can start using R even without any prior knowledge of writing R codes.

  

(Please download the files first (with right click and Save Link As…)  and then open from your computer)

 

Before you start, please go through the following  Data Management and Basic Statistics  notes (PPTX for saving; right click and Save Link As…)

0.Data Preparation   1.Statistical Concepts and Common Errors   2.Descriptive Statistics    3.Statistics for Count Data   4.Statistics for Continuous Data   5.Presentation of Results

PDF version of all of the above (for viewing)

Meta-Analysis

Survival Analysis and Statistical Power  

 

Basic information about R and links for R users

 R Notes (PDF)     R Links (PDF)

 

Session 1

(R basics and syntax) 

PPT  PPTX  PDF  Script

Video recordings (KUL only): Part 1  &  Part 2

 

Session 2

(Descriptive statistics and related graphics) 

PPT  PPTX  PDF  Script

Video recordings (KUL only): Part 1  &  Part 2

 

Session 3

(Inferential statistics I: Categorical data analysis)  

PPT  PPTX  PDF  Script

Video recordings (KUL only): Part 1  &  Part 2  (Appendix)

 

Session 4

(Inferential statistics II: Correlation, t-test, ANOVA and regression) 

PPT  PPTX  PDF  Script

 Video recordings (KUL only): Part 1  &  Part 2   &  Part3a / 3b

 

Session 5

(Beyond basic statistics: Shiny app; statistical power/sample size calculation; meta-analysis; survival analysis; ROC curve analysis)  

PPT  PPTX  PDF

Video recordings (KUL only): Part 1  &  Part 2

Scripts for session 5:

 shiny.R   pwr.R  

 survival.R   survival_time-to-event_sample_size_calculation.R  survival_coxph.R   survival_survminer.R

meta_analysis.R   epiR_meta.R   rmeta_cochrane.R   metafor_hr.R

 roc_cutoff.R

jv.csv  

 

 All sessions (1-5) as a single file (most up-to-date)

PPTX (40Mb; right click and Save Link As…)  PDF (17Mb)

  

Scripts

[to download:  right click and Save Link As…]

installation1.R

demo1.R

 quantmod.R   contingency.R   tiff.R

s1.R    s2.R    s3.R    s4.R

merge_files.R

pwr.R    shiny.R

survival.R    survival_time-to-event_sample_size_calculation.R   survival_coxph.R   survival_survminer.R

meta_analysis.R   epiR_meta.R   rmeta_cochrane.R   metafor_hr.R

roc_cutoff.R

  

 

Online resources (cookbook style resources for R users)

 Quick-R: http://www.statmethods.net (Book: R in Action */(online liveBook))

Instant R: Book > Using R for Statistics *; GitHub)

Cookbook for R: http://www.cookbook-r.com (Book: R Graphics Cookbook)

R Cookbook: http://shop.oreilly.com/product/9780596809164.do (PDF)

How to in R: http://howtoinr.weebly.com

R Tutorial: http://www.r-tutor.com/elementary-statistics

Basic Statistical Analysis Using the R Statistical Package (Boston University): http://sphweb.bumc.bu.edu/otlt/MPH-Modules/BS/R/R-Manual

Learn R (Data Science Made Simple): http://www.datasciencemadesimple.com/learn-r-what-is-r

Kickstarting R: https://cran.r-project.org/doc/contrib/Lemon-kickstart

* I find these two books most useful for beginners

 

You may also use the following two books (open access):

Learn to Use R: Your Hands-on Guide (ComputerWorld)

Introduction to Statistical Data Analysis with R (Matthias Kohl) by Bookboon (2015)

 

 

  www.dorak.info/r

 

Mehmet Tevfik DORAK, MD, PhD

 

 

 Epidemiology     Biostatistics     Genetic Epidemiology     Population Genetics    Genome Biology    Genetics     Glossary    Homepage

 

Last edited on 16 August 2023