Docsity
Docsity

Prepare for your exams
Prepare for your exams

Study with the several resources on Docsity


Earn points to download
Earn points to download

Earn points by helping other students or get them with a premium plan


Guidelines and tips
Guidelines and tips

RStudio IDE Cheat Sheet: A Comprehensive Guide to RStudio Features and Shortcuts, Cheat Sheet of Advanced Computer Programming

Typology: Cheat Sheet

2020/2021

Uploaded on 04/26/2021

anandit
anandit 🇺🇸

4.8

(19)

255 documents

1 / 2

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
RStudio IDE : : CHEAT SHEET
Write Code Pro Features
CC BY SA RStudio • Updated: 2016-01
Turn project into package,
Enable roxygen documentation with
Tools > Project Options > Build Tools
Roxygen guide at
Help > Roxygen Quick Reference
File > New Project >
New Directory > R Package
Share Project
with Collaborators
Active shared
collaborators
Select
R Version
Close R
Session in
project
J
H
T
RStudio saves the call history,
workspace, and working
directory associated with a
project. It reloads each when
you re-open a project.
Name of
current project
View(<data>) opens spreadsheet like view of data set
Sort by
values
Filter rows by value
or value range
Search
for value
Viewer Pane displays HTML content, such as Shiny apps,
RMarkdown reports, and interactive visualizations
Stop Shiny
app
Publish to shinyapps.io,
rpubs, RSConnect, …
Refresh
RStudio opens documentation in a dedicated Help pane
Home page of
helpful links
Search within
help file
Search for
help file
GUI Package manager lists ever y installed package
Click to load package with
library(). Unclick to detach
package with detach()
Delete
from
library
Install
Packages
Update
Packages
Create reproducible package
library for your project
RStudio opens plots in a dedicated Plots pane
Navigate
recent plots
Open in
window
Export
plot
Delete
plot
Delete
all plots
Package
version
installed
Examine variables
in executing
environment
Open with debug(), browse(), or a breakpoint. RStudio will open the
debugger mode when it encounters a breakpoint while executing code.
Open traceback to examine
the functions that R called
before the error occurred
Launch debugger
mode from origin
of error
Click next to
line number to
add/remove a
breakpoint.
Select function
in traceback to
debug
Highlighted
line shows
where
execution has
paused
Run commands in
environment where
execution has paused
Step through
code one line
at a time
Step into and
out of functions
to run
Resume
execution
Quit debug
mode
Open Shiny, R Markdown,
knitr, Sweave, LaTeX, .Rd files
and more in Source Pane
Check
spelling
Render
output
Choose
output
format
Choose
output
location
Insert
code
chunk
Jump to
previous
chunk
Jump
to next
chunk
Run
selected
lines
Publish
to server
Show file
outline
Set knitr
chunk
options
Run this and
all previous
code chunks
Run this
code chunk
Jump to
chunk
RStudio recognizes that files named app.R,
server.R, ui.R, and global.R belong to a shiny app
Run
app
Choose
location to
view app
Publish to
shinyapps.io
or server
Manage
publish
accounts
Access markdown guide at
Help > Markdown Quick Reference
Stage
files:
Show file
di
Commit
staged files
Push/Pull
to remote
View
History
current
branch
Added
Deleted
Modified
Renamed
Untracked
Turn on at Tools > Project Options > Git/SVN
Open shell to
type commands
A
D
M
R
?
Search inside
environment
Syntax highlighting based
on your file's extension
Code diagnostics that appear in the margin.
Hover over diagnostic symbols for details.
Tab completion to finish
function names, file paths,
arguments, and more.
Multi-language code
snippets to quickly use
common blocks of code.
Open in new
window
Save Find and
replace
Compile as
notebook
Run
selected
code
Re-run
previous code
Source with or
without Echo
Show file
outline
Jump to function in file Change file type
Navigate
tabs
A File browser keyed to your working directory.
Click on file or directory name to open.
Path to displayed director y
Upload
file
Create
folder
Delete
file
Rename
file
Change
directory
Displays saved objects by
type with short description
View function
source code
View in data
viewer
Load
workspace
Save
workspace
Import data
with wizard
Delete all
saved objects
Display objects
as list or grid
Choose environment to display from
list of parent environments
History of past
commands to
run/copy
Display .RPres slideshows
File > New File >
R Presentation
Working
Directory
Maximize,
minimize panes
Drag pane
boundaries
J
H
T
Cursors of
shared users
File > New Project
Press ! to see
command history
Multiple cursors/column selection
with Alt + mouse drag.
Documents and Apps R Support
PROJECT SYSTEM
Debug Mode Version Control with Git or SVN
Package Writing
pf2

Partial preview of the text

Download RStudio IDE Cheat Sheet: A Comprehensive Guide to RStudio Features and Shortcuts and more Cheat Sheet Advanced Computer Programming in PDF only on Docsity!

RStudio IDE : : CHEAT SHEET

Write Code Pro Features

CC BY SA RStudio • Updated: 2016-

Turn project into package, Enable roxygen documentation with Tools > Project Options > Build Tools Roxygen guide at Help > Roxygen Quick Reference

File > New Project > New Directory > R Package

Share Project with Collaborators

Active shared collaborators

Select R Version

Start new R Session in current project Close R Session in project

T H J

RStudio saves the call history, workspace, and working directory associated with a project. It reloads each when you re-open a project.

Name of current project

View() opens spreadsheet like view of data set

Sort by values

Filter rows by value or value range

Search for value

Viewer Pane displays HTML content, such as Shiny apps, RMarkdown reports, and interactive visualizations

Stop Shiny app

Publish to shinyapps.io, rpubs, RSConnect, …

Refresh

RStudio opens documentation in a dedicated Help pane

Home page of helpful links

Search within help file

Search for help file

GUI Package manager lists every installed package

Click to load package with library(). Unclick to detach package with detach()

Delete from library

Install Packages

Update Packages

Create reproducible package library for your project

RStudio opens plots in a dedicated Plots pane

Navigate recent plots

Open in window

Export plot

Delete plot

Delete all plots

Package version installed

Examine variables in executing environment

Open with debug(), browse(), or a breakpoint. RStudio will open the debugger mode when it encounters a breakpoint while executing code.

Open traceback to examine the functions that R called before the error occurred

Launch debugger mode from origin of error

Click next to line number to add/remove a breakpoint.

Select function in traceback to debug

Highlighted line shows where execution has paused

Run commands in environment where execution has paused

Step through code one line at a time

Step into and out of functions to run

Resume execution

Quit debug mode

Open Shiny, R Markdown, knitr, Sweave, LaTeX, .Rd files and more in Source Pane Check spelling

Render output

Choose output format

Choose output location

Insert code chunk

Jump to previous chunk

Jump to next chunk

Run selected lines

Publish to server

Show file outline

Set knitr chunk options

Run this and all previous code chunks

Run this code chunk

Jump to chunk

RStudio recognizes that files named app.R , server.R , ui.R , and global.R belong to a shiny app

Run app

Choose location to view app

Publish to shinyapps.io or server

Manage publish accounts

Access markdown guide at Help > Markdown Quick Reference

Stage files:

Show file diff

Commit staged files

Push/Pull to remote

View History

current branch

  • Added
  • Deleted
  • Modified
  • Renamed
  • Untracked

Turn on at Tools > Project Options > Git/SVN

Open shell to type commands

A D M R ?

Search inside environment

Syntax highlighting based on your file's extension

Code diagnostics that appear in the margin. Hover over diagnostic symbols for details.

Tab completion to finish function names, file paths, arguments, and more. Multi-language code snippets to quickly use common blocks of code.

Open in new window

Save Find and replace

Compile as notebook

Run selected code

Re-run previous code

Source with or without Echo

Show file outline

Jump to function in file Change file type

Navigate tabs

A File browser keyed to your working directory. Click on file or directory name to open.

Path to displayed directory

Upload file

Create folder

Delete file

Rename file

Change directory

Displays saved objects by type with short description

View function source code

View in data viewer

Load workspace

Save workspace

Import data with wizard

Delete all saved objects Display objects as list or grid

Choose environment to display from list of parent environments

History of past commands to run/copy

Display .RPres slideshows File > New File > R Presentation

Working Directory

Maximize, minimize panes Drag pane boundaries

T H J

Cursors of shared users

File > New Project

Press! to see command history

Multiple cursors/column selection with Alt + mouse drag.

Documents and Apps R Support

PROJECT SYSTEM

Debug Mode Version Control with Git or SVN

Package Writing

3 NAVIGATE CODE Windows /Linux Mac Goto File/Function Ctrl+. Ctrl+. Fold Selected Alt+L Cmd+Option+L Unfold Selected Shift+Alt+L Cmd+Shift+Option+L Fold All Alt+O Cmd+Option+O Unfold All Shift+Alt+O Cmd+Shift+Option+O Go to line Shift+Alt+G Cmd+Shift+Option+G Jump to Shift+Alt+J Cmd+Shift+Option+J Switch to tab Ctrl+Shift+. Ctrl+Shift+. Previous tab Ctrl+F11 Ctrl+F Next tab Ctrl+F12 Ctrl+F First tab Ctrl+Shift+F11 Ctrl+Shift+F Last tab Ctrl+Shift+F12 Ctrl+Shift+F Navigate back Ctrl+F9 Cmd+F Navigate forward Ctrl+F10 Cmd+F Jump to Brace Ctrl+P Ctrl+P Select within Braces Ctrl+Shift+Alt+E Ctrl+Shift+Option+E Use Selection for Find Ctrl+F3 Cmd+E Find in Files Ctrl+Shift+F Cmd+Shift+F Find Next Win: F3, Linux: Ctrl+G Cmd+G Find Previous W: Shift+F3, L: Ctrl+Shift+G

Cmd+Shift+G Jump to Word Ctrl+ "/# Option+ "/# Jump to Start/End Ctrl+!/$ Cmd+!/$ Toggle Outline Ctrl+Shift+O Cmd+Shift+O

8 DOCUMENTS AND APPS 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 (TeX and 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+F

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+Opt+F Check Package Ctrl+Shift+E Cmd+Shift+E Document Package Ctrl+Shift+D Cmd+Shift+D

6 VERSION CONTROL Windows/Linux^ Mac Show diff 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

5 DEBUG CODE Windows/Linux Mac Toggle Breakpoint Shift+F9 Shift+F Execute Next Line F10 F Step Into Function Shift+F4 Shift+F Finish Function/Loop Shift+F6 Shift+F Continue Shift+F5 Shift+F Stop Debugging Shift+F8 Shift+F

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+F 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 definition

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

1 LAYOUT Windows/Linux Mac Move focus to Source Editor Ctrl+1 Ctrl+ Move focus to Console Ctrl+2 Ctrl+ Move focus to Help Ctrl+3 Ctrl+ Show History Ctrl+4 Ctrl+ Show Files Ctrl+5 Ctrl+ Show Plots Ctrl+6 Ctrl+ Show Packages Ctrl+7 Ctrl+ Show Environment Ctrl+8 Ctrl+ Show Git/SVN Ctrl+9 Ctrl+ Show Build Ctrl+0 Ctrl+

Previous plot Ctrl+Alt+F11 Cmd+Option+F Next plot Ctrl+Alt+F12 Cmd+Option+F Show Keyboard Shortcuts Alt+Shift+K Option+Shift+K

RSP extends the the open source server with 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 are doing on 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 www.rstudio.com/products/rstudio-server-pro/

4 WRITE CODE Windows /Linux^ Mac WHY RSTUDIO SERVER PRO? 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+Backspace 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 for function F1 F Show source code unction

F2 F

New document Ctrl+Shift+N Cmd+Shift+N New document (Chrome) Ctrl+Alt+Shift+N Cmd+Shift+Opt+N Open document Ctrl+O 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+I 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

CC BY SA RStudio • Updated: 2016-