Introduction to R

Preview:

Citation preview

Introduction to2012-09-21 @HSPH

Kazuki Yoshida, M.D. MPH-CLE student

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

What is

http://www.r-project.org

?

is

a language and

environment for statistical computing and graphics

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

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

Many statisticalpackages

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

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

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

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

Advantages

is

Free as in free beer

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

is

Free as in freedom

http://www.thefreedomtrail.org

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

People care about free

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

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

4000+contributed

packages

Fast development

http://rpubs.com/kaz_yos/1285

Watchadditional

on-site demo

Disadvantages

L

Learninga new

languageis hard

Lack of variable labeling

Use memisc for partial fix

NHANES3 dataset

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

Not great for big data (yet)

Use ff, bigmemory, etc

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

Single core use

Turn on parallelization explicitly

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

Let’s get started!!

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

http://rstudio.org

http://www.r-project.org

GUI toolkit

http://rstudio.org

OR

Install!!

Follow on-site instruction

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

Comparison of environments

Standalone R.app

Fully functional Poor editor

RStudio editor

Fully functional Not GUI

http://rstudio.org

ESS on emacs editor

Fully functional emacs is hard

http://ess.r-project.org

Deducer GUI

Easy dialogues Very limited functionality

http://www.deducer.org

R Commander GUI

More functional Less sophisticated

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

For Your Information

editors

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

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

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

Recommended