intro to rstudio

15
Intro to RStudio Houston R Users Group Ed Goodwin, CFA

Upload: egoodwintx

Post on 08-Jan-2017

459 views

Category:

Data & Analytics


0 download

TRANSCRIPT

Page 1: Intro to RStudio

Intro to RStudioHouston R Users Group

Ed Goodwin, CFA

Page 2: Intro to RStudio

Why use an IDE?

Write Code

Compile Code

Run Code

Debug Code

Create Docs

Share Code

Version Control

Integrated Development Environment (IDE)

Page 3: Intro to RStudio

Why use RStudio?• built for R from the ground up (syntax highlighting, autocompletion, formatting)

• integrates R packages, documentation, debugging and viewing tools

• enforces best practices (documentation, version control, unit testing)

• community support

Page 4: Intro to RStudio

Versions of RStudioFeature RStudio Desktop RStudio Server RStudio Server Pro

License AGPL AGPL RStudio License

Price Free/$995 Free $9,995/server/yr

Full IDE ✓ ✓ ✓Remote Access ✓ ✓Load Balancing ✓Shiny Integration ✓ ✓ ✓

Group Admin Tools ✓Security Tools ✓

Monitoring Tools ✓

Page 5: Intro to RStudio

Preview Version of RStudio

• Customizable keybindings

• Pane zooming

• Multiple source windows

• Registering RStudio add-ins (RStudio ecosystem)

• Markdown improvements

https://www.rstudio.com/products/rstudio/download/preview/

Page 6: Intro to RStudio

RStudio IDE

Editor Panel

Console Panel

WorkspacePanel

PlotsPanel

Page 7: Intro to RStudio

Integrated Documentation

Page 8: Intro to RStudio

Help and Tutorialshttps://www.rstudio.com/resources/webinars/

Page 9: Intro to RStudio

Keyboard Shortcuts

Page 10: Intro to RStudio

Viewer• real time view of data

• filtering, sorting and search capability

Page 11: Intro to RStudio

Dygraphs• R interface to dygraphs

JavaScript library • Dygraphs package

independent of RStudio, but supported in the Plot panel

• install.packages(“dygraphs”) • supports zooming and panning

of time series

dygraph(pigs, main = "Monthly Pigs Slaughtered - Victoria") %>% dyRangeSelector(dateWindow = c("1980-01-01", "1996-01-01"))

Page 12: Intro to RStudio

RStudio ProjectsInitialize

• creates an .Rproj file to store settings • creates a .Rproj.user directory • Loads project into Rstudio into the toolbar

Project Options

Page 13: Intro to RStudio

Debugging• Breakpoints (Shft+F9)

• R functions

• browser()

• debugonce()

• Environment Pane

• Traceback (Callstack)

• Console

• step into function (Shft+F4)

• finish function (Shft+F6)

• continue running (Shft+F5)

• stop debugging (Shft+F8)

Resources• “Intro to Debugging in R

https://vimeo.com/99375765 • Advanced R chapter on Debugging

http://adv-r.had.co.nz/Exceptions-Debugging.html

Page 14: Intro to RStudio

Knitr and Markdownhttp://rmarkdown.rstudio.com/

Page 15: Intro to RStudio

Version Control

https://support.rstudio.com/hc/en-us/articles/200532077-Version-Control-with-Git-and-SVN