RStudio IDE :: Cheatsheet Documents and Apps 0 Write Code R Support Open Shiny, R Markdown, WT&i 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 fi app.\« gj Siript.R I" *✓ <^ ^KnltHTML I Run - - Jumpto Jump Run" Publish Showfile 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 ► plot(preksure) 15:1 Hop Level) RStudio recognizes that files named app.R, server.R, ui.R, and global.R belongto a shiny app O. RMarkdown.Rmd app.R Script.R fooCU [U_2_ foo <- functiont» > foo(2) fooCZ) _ foo(l) ■ Working Directory .. Press ^ to see command history Maximize, minimize panes Drag pane.......... Doundaries Create ! Upload Delete Rename folder ; file file file Path to displayed directory £j hello.R A File browser keyed to your working directory. Click on file or directory name to open. Change directory Apr 13. 2016, 11:17 AM Debug Mode Open with debug(), browserf), 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 Q Stage Showfile Commit Push/Pull view Click next to\ line numberto' add/remove a breakpoint. Highlighted line shows where execution has paused Console -/IDEcheatsheetNp '• > fOO() \ \ Error in get_digit(num, x>.,: t. show Traceback Error! " • Rerun with Debug files: I Added \ I Deleted j Modified | Renamed I Untracked d iff staged files to remote History Environment History Git ............... - r5iff Comniit " i" 9-_"w? er- © 5[aged Status Path Ignore... Q □ file-with-changes.R Open shell to ■■■■ sheii- current branch type commands Console ~/IDEcheatsheet/ < Next Cf= ► Conti íue ■ Stop Run commands in environment where execution has paused Examine variables in executing environment Selectfunction Stepthrough Stepintoand Resume Quitdebug in traceback to code one line out of functions execution mode debug atatime 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 Feat~ Share Project Active shared with Collaborators... collaborators I H J garrett Sessions' ®. * IDEcheatsheet ' R 3.2.2 ' ; New Project... _. Open Project... Close Project i | Share Project... IDEcheatsheet RStudlo-Essential Essentials shiny-examples Clear Project List Project Options... V R version 3.2^ R version 3.1.3 R version 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 lír a á3 R Arithmefie Operators - . \ Home page of helpful links Search within help file Search for help file Viewer Pane displays HTML content, such as Shiny apps, RMarkdown reports, and interactive visualizations Files Plots Packages Help Viewer eaCI sy\ a_ publish - $ Stop Shiny Publish to shinyapps.io, Refresh app rpubs, RSConnect,... View() opens spreadsheet like view of data set l Filter ■ Sepal.Length Sepal.Width Petal.Length ,- PetaLWidth | Species \\AI, \\\M | .* [All \\\AII l|- 5.1 3.S /l.4 0.2 :setosa 2 3 Filter rows by value Sort by Search 4 orvalue range values for value RStudio8 is a trademark of RStudio, Inc. • CCBYSA 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 Windows /Linux Mac Attempt completion Tab or Ctrl+Space Tab or Cmd+Space Navigate candidates Accept candidate Enter, Tab, or^ Enter, Tab, or^ Dismiss candidates Esc Esc Undo Ctrl+Z Cmd+Z Redo Ctrl+Shift+Z Cmd+Shift+Z Cut Ctrl+X Cmd+X Copy Ctrl+C Cmd+C Paste Ctrl+V Cmd+V Select All Ctrl+A Cmd+A Delete Line Ctrl+D Cmd+D Select Shift+[Arrow] Shift+[Arrow] Select Word Ctrl+Shift+«-/-» Option+Shift+ Select to Line Start Alt+Shift+<- Cmd+Shift+<- Select to Line End Alt+Shift+-» Cmd+Shift+-> Select Page Up/Down Shift+PageUp/Down Shift+PageUp/Down Select to Start/End Shift+Alt+*/* Cmd+Shift+*/* Delete Word Left Ctrl+Esackspace Ctrl+Opt+Backspace Delete Word Right Option+Delete Delete to Line End Ctrl+K Delete to Line Start Option+Backspace Indent Tab (at start of line) Tab (at start of line) Outdent Shift+Tab Shift+Tab Yank line up to cursor Ctrl+U Ctrl+U Yank line after cursor Ctrl+K Ctrl+K Insert yanked text Ctrl+Y Ctrl+Y Insert <- Alt+- Option+- Insert %>% Ctrl+Shift+M Cmd+Shift+M Show help forfunction Fl Fl Show source code F2 F2 New document Ctrl+Shift+N Cmd+Shift+N New document (Chrome) Ctrl+Alt+Shift+N Cmd+Shift+Opt+N Open document Ctrl+0 Cmd+O Save document Ctrl+S Cmd+S Close document Ctrl+W Cmd+W Close document (Chrome) Ctrl+Alt+W Cmd+Option+W Close all documents Ctrl+Shift+W Cmd+Shift+W Extract function Ctrl+Alt+X Cmd+Option+X Extract variable Ctrl+Alt+V Cmd+Option+V Reindent lines Ctrl+1 Cmd+I (Un)Comment lines Ctrl+Shift+C Cmd+Shift+C Reflow Comment Ctrl+Shift+/ Cmd+Shift+/ Reformat Selection Ctrl+Shift+A Cmd+Shift+A Select within braces Ctrl+Shift+E Ctrl+Shift+E Show Diagnostics Ctrl+Shift+Alt+P Cmd+Shift+Opt+P Transpose Letters Ctrl+T Move Lines Up/Down Alt+*/* Option+^/* Copy Lines Up/Down Shift+Alt+*/* Cmd+Option+^/* Add New Cursor Above Ctrl+Alt+Up Ctrl+Option+Up Add New Cursor Below Ctrl+Alt+Down Ctrl+Option+Down Move Active Cursor Up Ctrl+Alt+Shift+Up Ctrl+Option+Shift+Up Move Active Cursor Down Ctrl+Alt+Shift+Down Ctrl+Opt+Shift+Down Find and Replace Ctrl+F Cmd+F Use Selection for Find Ctrl+F3 Cmd+E Replace and Find Ctrl+Shift+J Cmd+Shift+J WHY RSTUDIO SERVER PRO? RSP extends the ots open source serverwj^^B commercial license, support, and more: i • open and run multiple R sessions at once • tune your resources to improve performance 1 • 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 R 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 cd 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 RStudio8 is a trademark of RStudio, Inc. • CCBYSA RStudio- info@rstudio.com • 844-448-1212-rstudio.com- Learn moreatwww.rstudio.com • RStudiolDE 0.1.0 • Updated: 2017-09