R meet up slides.pptx

20
Introduc)on to R and RStudio Corey S. Sparks Department of Demography The University of Texas at San Antonio September 22, 2012 Sponsored by the UTSA Department of Demography

description

These are slides from the second Alamo Area R user group meeting, where I gave an intro to R and RStudio

Transcript of R meet up slides.pptx

Page 1: R meet up slides.pptx

Introduc)on  to    R  and  RStudio  

Corey  S.  Sparks  Department  of  Demography  

The  University  of  Texas  at  San  Antonio  September  22,  2012  

Sponsored  by  the  UTSA  Department  of  Demography  

Page 2: R meet up slides.pptx

What  is  R?  

•  R  is  a  system  for  sta)s)cal  computa)on  and  graphics.    

•  It  is  heavily  influenced  by  the  S  language  •  R  was  ini)ally  wriJen  by  Ross  Ihaka  and  Robert  Gentleman  at  the  Department  of  Sta)s)cs  of  the  University  of  Auckland  in  Auckland,  New  Zealand.  

•  The  “R  Core  Team”  maintain  the  source  code  for  the  soPware  and  release  regular  updates  

Page 3: R meet up slides.pptx

What  is  R?  

•  The  R  soPware  contains  func)onality  for  a  large  number  of  sta)s)cal  procedures.  

•  Linear  and  generalized  linear  models  

•  Nonlinear  regression  models  

•  Time  series  analysis  

•  Classical  parametric  and  nonparametric  tests,  clustering  and  smoothing.  

Page 4: R meet up slides.pptx

What  is  R?  

•  In  addi)on,  the  R  project  is  added  to  by  many  of  its  users,  who  write  source  code  for  many  different  types  of  analy)cal  procedures  

•  Everything  from  analy)cal  chemistry  to  epidemiology  to  linguis)cs    – OPen  code  is  wriJen  in  FORTRAN  or  C++  and  ported  to  R  

– Currently  4,045  different  user-­‐wriJen  libraries  available  

Page 5: R meet up slides.pptx

Where  can  I  run  R?    

•  R  runs  on  a  variety  of  pla\orms  – Windows  

– Mac  OS  X  – Linux  – Unix  

•  32  and  64  bit  installa)ons  •  Support  for  parallel  compu)ng  and  clusters  

Page 6: R meet up slides.pptx

Revolu)on  R  

•  Commercial  version  of  R  soPware  

•  Revolu)on  R  is  compiled  for  mul)-­‐core  support  

•  Allows  for  a  marked  reduc)on  in  computa)on  )mes  because  of  op)mized  code  and  certain  math  system  libraries  (BLAS,  ATLAS,  etc)  

Page 7: R meet up slides.pptx

What  makes  R  so  great?  

•  Open  source  •  User  community  

•  Cudng  edge  development  

•  Integra)on  with  low  level  programming  languages  

•  Flexibility  •  Mul)-­‐language  support  

Page 8: R meet up slides.pptx

The  R  Interface  

•  Depends  on  where  you  run  it  •  Different  OS’s  have  very  different  interfaces  •  R  is  inherently  command  line-­‐oriented  

•  Several  GUIs  have  been  wriJen  

Page 9: R meet up slides.pptx

RStudio  

•  Rela)vely  recent  incarna)on  of  an  R  IDE  •  Open  source    •  Desktop  and  server  versions  

•  Lots  of  cool  features  –  syntax  highligh)ng  – workspace  and  data  browser/editor  –  integrated  help  system  –  integrated  history  –  runs  on  all  OS’s  

Page 10: R meet up slides.pptx

RStudio  Screen  

Page 11: R meet up slides.pptx

Code  editor  

Page 12: R meet up slides.pptx

R  command  console  

Page 13: R meet up slides.pptx

Workspace  browser  

Page 14: R meet up slides.pptx

Command  History  

Page 15: R meet up slides.pptx

Package  manager  

Page 16: R meet up slides.pptx

File  manager  

Page 17: R meet up slides.pptx

Plot  manager  

Page 18: R meet up slides.pptx

Integrated  help  system  

Page 19: R meet up slides.pptx

Addi)onal  Cool  things  

•  Mul)ple  project  management  – Keep  mul)ple  code  files  for  separate  projects  

•  Lots  of  keyboard  shortcuts  •  Generate  HTML  reports  with  knitr  

•  Customized  IDE  

Page 20: R meet up slides.pptx