intro to rstudio
TRANSCRIPT
Intro to RStudioHouston R Users Group
Ed Goodwin, CFA
Why use an IDE?
Write Code
Compile Code
Run Code
Debug Code
Create Docs
Share Code
Version Control
Integrated Development Environment (IDE)
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
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 ✓
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/
RStudio IDE
Editor Panel
Console Panel
WorkspacePanel
PlotsPanel
Integrated Documentation
Help and Tutorialshttps://www.rstudio.com/resources/webinars/
Keyboard Shortcuts
Viewer• real time view of data
• filtering, sorting and search capability
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"))
RStudio ProjectsInitialize
• creates an .Rproj file to store settings • creates a .Rproj.user directory • Loads project into Rstudio into the toolbar
Project Options
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
Knitr and Markdownhttp://rmarkdown.rstudio.com/
Version Control
https://support.rstudio.com/hc/en-us/articles/200532077-Version-Control-with-Git-and-SVN