52
Introduction to 2012-09-21 @HSPH Kazuki Yoshida, M.D. MPH-CLE student

Introduction to R

Embed Size (px)

Citation preview

Page 1: Introduction to R

Introduction to2012-09-21 @HSPH

Kazuki Yoshida, M.D. MPH-CLE student

Page 2: Introduction to R

Menu

n What is R?

n How does it compare to others?

n What are the advantages/disadvantages of R?

n Let’s install R.

n Editors and GUIs: How to make R more friendly

Page 3: Introduction to R

What is

http://www.r-project.org

?

Page 4: Introduction to R

is

a language and

environment for statistical computing and graphics

http://www.r-project.org/about.html

Page 5: Introduction to R

Menu

n What is R?

n How does it compare to others?

n What are the advantages/disadvantages of R?

n Let’s install R.

n Editors and GUIs: How to make R more friendly

Page 6: Introduction to R

Many statisticalpackages

Page 7: Introduction to R

Software

Cost$65/yr

(+Parallels&Windows)

$179 Free for you None $55/yr

Mode of use Commands Menus or commands Menus Commands

(or menus)Menus (or commands)

Prevalence at HSPH

Very prevalent

esp. in Epi

Moderately prevalent esp in Bio

Seasonal cases in

June

Rel. rare. Incidence

increasing?

Rare. More prevalent in

wild

SAS Stata JMP SPSSR

Page 8: Introduction to R

Other packagesn CDC Epi Info: Field epidemiology

n TreeAgePro: Decision science

n SUDAAN: Survey data

n WinBUGS: Markov chain Monte Carlo

n Python: General-purpose programming language

n matlab, mathematica: Mathematics

Page 9: Introduction to R

Courses taught in R

n BIO 232 (Fall) Stat Methods I

n BIO 509 (Fall) Intro Stat Comp Environments

n BIO 503 (Winter) Program and Stat Model in R

n ID 271 (Spring) Adv Regression for Env Epi

n HMS BMI713.0 (Fall) Comp Stat for Biomed Scihttp://informaticstraining.hms.harvard.edu/content/lectures-and-problem-sets

http://isites.harvard.edu/icb/icb.do?keyword=k84377

Page 10: Introduction to R

Menu

n What is R?

n How does it compare to others?

n What are the advantages/disadvantages of R?

n Let’s install R.

n Editors and GUIs: How to make R more friendly

Page 11: Introduction to R

Advantages

Page 12: Introduction to R

is

Free as in free beer

http://en.wikipedia.org/wiki/Free_Beer

Page 13: Introduction to R

is

Free as in freedom

http://www.thefreedomtrail.org

Page 14: Introduction to R

http://chereemoore.blogspot.com/2011/06/live-free-or-die.html

People care about free

Page 15: Introduction to R

is

Developed by

& user community

Core Developer Team:Douglas Bates, John Chambers, Peter Dalgaard, Seth Falcon, Robert Gentleman (Left), Kurt Hornik, Stefano Iacus, Ross Ihaka (Right), Friedrich Leisch, Uwe Ligges, Thomas Lumley, Martin Maechler, Duncan Murdoch, Paul Murrell, Martyn Plummer, Brian Ripley, Deepayan Sarkar, Duncan Temple Lang, Luke Tierney, Simon Urbanek

http://www.nytimes.com/2009/01/07/technology/business-computing/07program.html?pagewanted=all

Robert Gentleman Ross Ihaka

Page 16: Introduction to R

http://r4stats.com/articles/popularity/

4000+contributed

packages

Fast development

Page 18: Introduction to R

http://rpubs.com/kaz_yos/1285

Page 20: Introduction to R

Watchadditional

on-site demo

Page 22: Introduction to R

Disadvantages

Page 23: Introduction to R

L

Learninga new

languageis hard

Page 25: Introduction to R

Lack of variable labeling

Use memisc for partial fix

NHANES3 dataset

Page 26: Introduction to R

http://newscenter.berkeley.edu/2012/03/29/nsf-big-data-grant/

Not great for big data (yet)

Use ff, bigmemory, etc

Page 27: Introduction to R

http://techreport.com/articles.x/15818

Single core use

Turn on parallelization explicitly

Page 28: Introduction to R

Menu

n What is R?

n How does it compare to others?

n What are the advantages/disadvantages of R?

n Let’s install R.

n Editors and GUIs: How to make R more friendly

Page 29: Introduction to R

Let’s get started!!

Page 30: Introduction to R

Download!!http://www.r-project.org

http://rstudio.org

Page 31: Introduction to R

http://www.r-project.org

Page 32: Introduction to R
Page 33: Introduction to R
Page 34: Introduction to R
Page 35: Introduction to R

GUI toolkit

Page 36: Introduction to R

http://rstudio.org

Page 37: Introduction to R

OR

Page 38: Introduction to R

Install!!

Page 39: Introduction to R

Follow on-site instruction

Page 40: Introduction to R

Menu

n What is R?

n How does it compare to others?

n What are the advantages/disadvantages of R?

n Let’s install R.

n Editors and GUIs: How to make R more friendly

Page 41: Introduction to R

Comparison of environments

Page 42: Introduction to R

Standalone R.app

Fully functional Poor editor

Page 43: Introduction to R

RStudio editor

Fully functional Not GUI

http://rstudio.org

Page 44: Introduction to R

ESS on emacs editor

Fully functional emacs is hard

http://ess.r-project.org

Page 45: Introduction to R

Deducer GUI

Easy dialogues Very limited functionality

http://www.deducer.org

Page 46: Introduction to R

R Commander GUI

More functional Less sophisticated

http://socserv.mcmaster.ca/jfox/Misc/Rcmdr/

Page 48: Introduction to R
Page 49: Introduction to R

For Your Information

Page 51: Introduction to R

editors

n RStudio: http://www.rstudio.org

n ESS for emacs: http://ess.r-project.org

Page 52: Introduction to R

GUI

n R Commander: http://socserv.mcmaster.ca/jfox/Misc/Rcmdr/

n EZR: http://www.jichi.ac.jp/saitama-sct/SaitamaHP.files/statmedEN.html

n Deducer: http://www.deducer.org/

n Rattle: http://rattle.togaware.com