RStudio IDE :: Cheatsheet Documents and Apps 0\ Write Code R Support Open Shiny, R Markdown, MfeX knitr, Sweave, LaTeX, .Rd files and more in Source Pane Check Render Choose Choose Insert spelling output output output code format location chunk Navigate tabs Open in new window Save Find and replace Compile as notebook Run selected .- code Import data with wizard History of past commands to run/copy Display .RPres slideshows File > New File > R Presentation >_ RMarkdown.Riri'4 ■ Q appX_x fij Siript.P. .•" Jumpto Jump Run" Publish Showfile I previous to next selected to server outline chunk chunk lines Access markdown guide at Help > Markdown Quick Reference Jumpto Set knitr Run this and Run this chunk chunk allprevious codechunk options code chunks {r pressure, echo=FALSE} & z ► plotCpressure) 15:1 (Top Level) RStudio recognizes that files named app.R, server.R, ui.R, and global.R belongto a shiny app OjRM rkdown.Rmd Qa p.Rx QScflpLB All H 1 4 O .........► Run App.. 1;*.- 1 S 1 2 Run Choose Publish to •*' Manage 3 4 app location to shinyapps.io publish 5 view app orserver accounts 1:1 (Top Level) ; P. Script : Code.-* View Plots Session Build yDebug Tools Hejtf 3 ■ _ • Adttfns ' B RMarkdoÄn.Rrnd..* 0] app.R * ß S/rlpt.R G Source on Save jfi, | f~[ _.» Run.... ^ ^Source • 1 |# Good Start...I ^Z^^77^ 7^ 2 ! Cursors of Re-run Source with or 3 '"shared users previous code without Echo I» J food) [ILL Change directory foo <- function(x) x + 1 fooCZ) fooC2)_ ■ Working Directory .. Press ^ to see command history Maximize, minimize panes Drag pane.......... Doundaries Path to displayed directory t. .. □ hello.R 1? A File browser keyed to your working directory. Click on file or directory name to open. Apr 13, 2016, 11:17 AM Debug Mode Open with debug(), browsef), or a breakpoint. RStudio will open the debugger mode when it encounters a breakpoint while executing code. Launch debugger mode from origin of error Open tracebackto examine the functions that R called before the error occurred Version Control with Git or SVN _|_ Turn on atTools> Project Options >Git/SVN {J Stage Showfile Commit Push/Pull view Click next to\ line numberto' add/remove a breakpoint. Highlighted line shows where execution has paused , digitZ <■ get.digit ni/i. Console IDEcheatsheet/*-..^ » fooO *\ Error in get_digit(num, x>-,; Error! Show Traceback Rerun with Debug files: I Added \ I Deleted I Modified I Renamed I Untracked d iff staged files to remote History Environment Histp'ry Clt □iff Comm'it ' i' munr> 1 © Staged Status Path „ Ignore... file-with-changes.R Open shell to type commands current branch ■ ■■■ Shell... Console -/IDEcheatsheet/ < Next kI (+- ► Contj ue ■ Stop Run commands in environment where execution has paused Examine variables Select function in executing in traceback to environment debug Step through Step into and Resume Quit debug code one line out of functions execution mode at a time to run ^Studio Package Writing I File > New Project > iV New Directory > R Package Turn project into package, Enable roxygen documentation with Tools > Project Options > Build Tools Roxygen guide at Help > Roxygen Quick Reference Pro Features ■ @Studi Share Project Active shared with Collaborators... collaborators |h J ' garrett • Sessions K IDEcheatsheet * * New Project... d! Open Project... Close Project gB Share Project... IDEcheatsheet SI RStudio- Essentials Essentials SI shiny-examples SI Clear Project List : Project Options... / oh, R 3.2.2 - */ Rversion 3.Z:2, Rversion 3.1.3 ' Rversion 3.0.3 R version 2.15.3 Start new R Session in current project ........Close R Session in project Select R Version Name of current project PROJECT SYSTEM File > New Project RStudio saves the call history, workspace, and working directory associated with a project. It reloads each when you re-open a project. RStudio opens plots in a dedicated Plots pane Files Plots Package Help Viewer £ .-v & Zoom | Export^ Q... /. % Publish i Navigate Open in Export ' Delete" ' Delete recent plots window plot plot all plots GUI Package manager lists every installed package Install Update Create reproducible package Packages Packages library for your project Click to load package with LibraryO Unclick to detach package with detach() Package Delete version from installed library RStudio opens documentation in a dedicated Help pane Files Plots Packages Help Viewer ♦ » & jrf g It Arithmefic Operators - Find in Topio \ Home page of Search within Search for helpful links help file help file Viewer Pane displays HTML content, such as Shiny apps, RMarkdown reports, and interactive visualizations Files Plots Packages Help Viewer s±_ß_ Publish . ® Stop Shiny Publish to shinyapps.io, Refresh app rpubs, RSConnect,... View() opens spreadsheet like view of data set Filter Sepal. Length Sepal.Width Petal.Length ,■ Petal.Width | Species \aii I \aii 1 / \\\aii 1 \ S.l 1 3.5 /l.4 0,2:setosa 2 3 Filter rows by value Sort by Search 4 orvalue range values for value RStudio® is a trademark of RStudio, Inc. • CC BY RStudio« info@rstudio.com • 844-448-1212 • rstudio.com • Learnmoreatwww.rstudio.com • RStudio IDE 0.99.832 • Updated: 2016-01 1 LAYOUT Windows/Linux Mac Move focus to Source Editor Ctrl+1 Ctrl+1 Move focus to Console Ctrl+2 Ctrl+2 Move focus to Help Ctrl+3 Ctrl+3 Show History Ctrl+4 Ctrl+4 Show Files Ctrl+5 Ctrl+5 Show Plots Ctrl+6 Ctrl+6 Show Packages Ctrl+7 Ctrl+7 Show Environment Ctrl+8 Ctrl+8 ShowGit/SVN Ctrl+9 Ctrl+9 Show Build Ctrl+0 Ctrl+0 2 RUN CODE Windows/Linux Mac Search command history Ctrl+* Cmd+* Navigate command history Move cursor to start of line Home Cmd+«- Move cursor to end of line End Cmd+* Change working directory Ctrl+Shift+H Ctrl+Shift+H Interrupt current command Esc Esc Clear console Ctrl+L Ctrl+L Quit Session (desktop only) Ctrl+Q Cmd+Q Restart R Session Ctrl+Shift+F10 Cmd+Shift+FlO Run current line/selection Ctrl+Enter Cmd+Enter Run current (retain cursor) Alt+Enter Option+Enter Run from current to end Ctrl+Alt+E Cmd+Option+E Run the current function Ctrl+Alt+F Cmd+Option+F Source a file Ctrl+Alt+G Cmd+Option+G Source the current file Ctrl+Shift+S Cmd+Shift+S Source with echo Ctrl+Shift+Enter Cmd+Shift+Enter 3 NAVIGATE CODE Goto File/Function Fold Selected Unfold Selected Fold All Unfold All Go to line Jump to Switch to tab Previous tab Next tab First tab Last tab Navigate back Navigate forward Jump to Brace Select within Braces Use Selection for Find Find in Files Find Next Find Previous Jump to Word Jump to Start/End Toggle Outline Windows/Linux Ctrl+. Alt+L Shift+Alt+L Alt+O Shift+Alt+O Shift+Alt+G Shift+Alt+J Ctrl+Shift+. Ctrl+Fll Ctrl+F12 Ctrl+Shift+Fll Ctrl+Shift+F12 Ctrl+F9 Ctrl+F10 Ctrl+P Ctrl+Shift+Alt+E Ctrl+F3 Ctrl+Shift+F Win:F3, Linux: Ctrl+G W: Shift+F3, L: Ctrl+«-/* Ctrl+*/+ Ctrl+Shift+O Mac Ctrl+. Cmd+Option+L Cmd+Shift+Option+L Cmd+Option+O Cmd+Shift+Option+O Cmd+Shift+Option+G Cmd+Shift+Option+J Ctrl+Shift+. Ctrl+Fll Ctrl+F12 Ctrl+Shift+Fll Ctrl+Shift+F12 Cmd+F9 Cmd+F10 Ctrl+P Ctrl+Shift+Option+E Cmd+E Cmd+Shift+F Cmd+G Cmd+Shift+G Option+«-/-» Cmd+*/* Cmd+Shift+O @Stud 10 4 WRITE CODE Attempt completion Navigate candidates Accept candidate Dismiss candidates Undo Redo Cut Copy Paste Select All Delete Line Select Select Word Select to Line Start Select to Line End Select Page Up/Down Select to Start/End Delete Word Left Delete Word Right Delete to Line End Delete to Line Start Indent Outdent Yank line up to cursor Yank line after cursor Insert yanked text Insert <-Insert %>% Show help forfunction Show source code New document New document (Chrome) Open document Save document Close document Close document (Chrome) Close all documents Extract function Extract variable Reindent lines (Un)Comment lines Reflow Comment Reformat Selection Select within braces Show Diagnostics Transpose Letters Move Lines Up/Down Copy Lines Up/Down Add New Cursor Above Add New Cursor Below Move Active Cursor Up Move Active Cursor Down Find and Replace Use Selection for Find Replace and Find Windows /Linux Mac Tab or Ctrl+Space Tab or Cmd+Space Enter, Tab, or^ Enter, Tab, or^ Esc Esc Ctrl+Z Cmd+Z Ctrl+Shift+Z Cmd+Shift+Z Ctrl+X Cmd+X Ctrl+C Cmd+C Ctrl+V Cmd+V Ctrl+A Cmd+A Ctrl+D Cmd+D Shift+[Arrow] Shift+[Arrow] Ctrl+Shift+«-/-> Option+Shift+<-/-> Alt+Shift+<- Cmd+Shift+<- Alt+Shift+-» Cmd+Shift+-> Shift+PageUp/Down Shift+PageUp/Down Shift+Alt+*/* Cmd+Shift+*/* Ctrl+Esackspace Ctrl+Opt+Backspace Option+Delete Ctrl+K Option+Backspace Tab (at start of line) Tab (at start of line) Shift+Tab Shift+Tab Ctrl+U Ctrl+U Ctrl+K Ctrl+K Ctrl+Y Ctrl+Y Alt+- Option+- Ctrl+Shift+M Cmd+Shift+M Fl Fl F2 F2 Ctrl+Shift+N Cmd+Shift+N Ctrl+Alt+Shift+N Cmd+Shift+Opt+N Ctrl+0 Cmd+O Ctrl+S Cmd+S Ctrl+W Cmd+W Ctrl+Alt+W Cmd+Option+W Ctrl+Shift+W Cmd+Shift+W Ctrl+Alt+X Cmd+Option+X Ctrl+Alt+V Cmd+Option+V Ctrl+1 Cmd+I Ctrl+Shift+C Cmd+Shift+C Ctrl+Shift+/ Cmd+Shift+/ Ctrl+Shift+A Cmd+Shift+A Ctrl+Shift+E Ctrl+Shift+E Ctrl+Shift+Alt+P Cmd+Shift+Opt+P Ctrl+T Alt+*/* Option+^/* Shift+Alt+*/* Cmd+Option+^/* Ctrl+Alt+Up Ctrl+Option+Up Ctrl+Alt+Down Ctrl+Option+Down @Studi Ctrl+Alt+Shift+Up Ctrl+Alt+Shift+Down Ctrl+F Ctrl+F3 Ctrl+Shift+J Ctrl+Option+Shift+Up Ctrl+Opt+Shift+Down Cmd+F Cmd+E Cmd+Shift+J WHY RSTUDIO SERVER PRO? RSP extends the the open source serverwith a commercial license, support, and more: • open and run multiple R sessions at once • tune your resources to improve performance • edit the same project at the same time as others' • see what you and others aredoingon your server . switch easily from one version of R to a different version • integrate with your authentication, authorization, and audit practices Download a free 45 day evaluation at 5 DEBUG CODE Windows/Linux Mac Toggle Breakpoint Shift+F9 Shift+F9 Execute Next Line F10 F10 Step Into Function Shift+F4 Shift+F4 Finish Function/Loop Shift+F6 Shift+F6 Continue Shift+F5 Shift+F5 Stop Debugging Shift+FS Shift+FS 6 VERSION CONTROL Windows/Linux Mac Show d iff Ctrl+Alt+D Ctrl+Option+D Commit changes Ctrl+Alt+M Ctrl+Option+M Scroll diff view Ctrl+*/+ Ctrl+*/+ Stage/Unstage (Git) Spacebar Spacebar Stage/Unstage and move to next Enter Enter 7 MAKE PACKAGES Windows/Linux Mac Build and Reload Ctrl+Shift+B Cmd+Shift+B Load All (devtools) Ctrl+Shift+L Cmd+Shift+L Test Package (Desktop) Ctrl+Shift+T Cmd+Shift+T Test Package (Web) Ctrl+Alt+F7 Cmd+0pt+F7 Check Package Ctrl+Shift+E Cmd+Shift+E Document Package Ctrl+Shift+D Cmd+Shift+D 8 DOCUMENTSANDAPPS Windows/Linux Mac Preview HTML (Markdown, etc.) Ctrl+Shift+K Cmd+Shift+K Knit Document (knitr) Ctrl+Shift+K Cmd+Shift+K Compile Notebook Ctrl+Shift+K Cmd+Shift+K Compile PDF (TeXand Sweave) Ctrl+Shift+K Cmd+Shift+K Insert chunk (Sweave and Knitr) Ctrl+Alt+I Cmd+Option+I Insert code section Ctrl+Shift+R Cmd+Shift+R Re-run previous region Ctrl+Shift+P Cmd+Shift+P Run current document Ctrl+Alt+R Cmd+Option+R Run from start to current line Ctrl+Alt+B Cmd+Option+B Run the current code section Ctrl+Alt+T Cmd+Option+T Run previous Sweave/Rmd code Ctrl+Alt+P Cmd+Option+P Run the current chunk Ctrl+Alt+C Cmd+Option+C Run the next chunk Ctrl+Alt+N Cmd+Option+N Sync Editor & PDF Preview Ctrl+F8 Cmd+F8 Previous plot Ctrl+Alt+Fll Cmd+Option+Fll Next plot Ctrl+Alt+F12 Cmd+Option+F12 Show Keyboard Shortcuts Alt+Shift+K Option+Shift+K RStudio® is a trademark of RStudio, Inc. • CCBYRStudio« info@rstudio.com • 844-448-1212 • rstudio.com • Learn moreatwww.rstudio.com • RStudiolDE 0.1.0 • Updated: 2017-09