Skip to content

Cheat sheet

One page to keep open while you work. “Cmd/Ctrl” means Cmd on a Mac and Ctrl on Windows and Linux. The data viewer keys Ctrl+Alt+E, Ctrl+Alt+I, Ctrl+Alt+R and Ctrl+Alt+F use the Control key on a Mac too. F9 in an R file shows every key of the extension. (Pro) marks the Professional edition, free during Early Access until 17 February 2027.

Key or command What runs Chapter
F4 the selection; with nothing selected, the whole file 20
Cmd/Ctrl+Enter the selection, or the line 20
Cmd/Ctrl+Shift+Enter the whole file (Run R File in the Session) 20
Cmd/Ctrl+Alt+T Run to Line: from the top to the cursor 20
Run from Line from the cursor to the end 20
Cmd/Ctrl+Alt+C Stop the Running Code; the objects stay 20
Start the R Session, Show Log of the Last Run a new session; the log as a page 20
Terminal What it does
dsr run prog.R run in the session: the log and the verdict
dsr run prog.R --from-line 4 --to-line 9 run a part (whole expressions)
dsr log --filter suspicious | errors | notes | rules the suspicious log, the errors, the NOTEs, the rules
dsr status, dsr ls, dsr history the session, its objects, the last runs
dsr stop, dsr stop --session, dsr start stop the code, end the session, start a new one
Key or view What it does
F2 clear the log and the console
F12 open the last data frame a run made
Suspicious Log view, Problems panel, F8 the messages that matter, each at its line; the next problem
Data, What the Last Run Made, Values and Functions the views of the session
RStudio Layout, Reset Layout the four panes of RStudio (Environment, History, Files, Plots, Packages, Help), and back
Shift+F1 the help of the function at the cursor

Verdicts: RESULT: CLEAN (no error, no warning) · CHECK (read the FIRST CAUSE) · ERROR (fix the first cause) · PRY (the run waits at a stop) · STOPPED (quit at a stop).

Key What it does
F12, Ctrl+Alt+D (Mac: Cmd+Alt+D) the last data frame; the data frame at the cursor
? every key
arrows, PageUp, PageDown, Home, End, g move; go to a row
w the WHERE box (an R condition)
/, Ctrl+F search the shown columns
t, Shift+T the filter box of the column (>65, 65..80, a,b, !a, R*, ., 01JAN2014); show or hide the filter row
f, Ctrl+Alt+I the values of the column; the value picker with the value of the cell ticked
Enter / Shift+Enter, x keep / remove the rows with the value of the cell
Ctrl+Alt+E column == value into the WHERE box
Delete, Backspace remove the filters of the column
Ctrl+Alt+R every row again (the sort stays)
Ctrl+Backspace (Mac: Cmd+Backspace) clear everything, the sort too
Shift+F, q the filter builder; Ask…: a question in words
Ctrl+Alt+F find a column by its name or label
s, Shift+S, a, d sort; add a sort key; ascending; descending
c, h choose columns; hide the column
l, v, m labels; raw or formatted values; the Summary panel
Space the row as a record
Ctrl+C, Ctrl+Shift+C copy; copy with the names
r read the page again
Ctrl+Alt+J (Mac: Cmd+Alt+J) back to the line of the program
F3, Shift+F4, Alt+W, Esc close the viewer

Buttons: Columns, Find column…, Filters, Filter…, Copy, Export CSV, Views, R code, Keys, Summary, Labels, Raw, Open…. More in chapter 21.

Terminal What it does
dsr query adae --where '...' --vars '...' --sort '-AGE' --n 20 rows; --count only the number; --code the view as R code
dsr freq adae TRT01A --where '...' --subjects counts of values; subjects instead of rows
dsr values adae AESEV --keep 'SEVERE,MODERATE' the value picker and its condition
dsr filter adsl AGE '>80' a column filter as an R condition
dsr describe adae --find rel, dsr profile cm the columns; what is in each column
dsr dups adae --key 'USUBJID AESEQ', dsr compare a b --key USUBJID duplicate keys; two data sets value by value
dsr subject 01-701-1015 one subject across all data frames
Key What it does
Ctrl+Space completion: functions, arguments, columns with their labels
a prefix + Tab a snippet: dsr-header, adsl-agegr, adae-dates, bds-chg, t-incidence, t-summary, pry-when, test-that, …
Ctrl+Shift+A (Mac: Cmd+Shift+A), Shift+Alt+F Format R Program: the tidyverse layout, with its proof
Ctrl+. (Mac: Cmd+.) on a function Insert roxygen header
Ctrl+Shift+E / Ctrl+Shift+O (Pro) Enlarge / Optimize Function Call
Ctrl+click, Ctrl+Alt+G go to the definition
Alt+F12 peek at the definition
Shift+F12, Ctrl+Alt+U every use; Find Every Use with the possible ones
Shift+F2 rename, with its proof
Ctrl+Alt+O, Ctrl+T, Ctrl+P a symbol of this file; of the project; a file
Ctrl+Alt+J back to the line you came from

On a Mac, the keys to move use Cmd: Cmd+click, Cmd+Alt+G, Cmd+Alt+U, Cmd+Alt+O, Cmd+T, Cmd+P and Cmd+Alt+J. Alt+F12, Shift+F12 and Shift+F2 are the same on every system.

Terminal What it does
dsr complete file.R:line:col, dsr syntax pkg::fn what fits there; the arguments of a function
dsr format file.R [--check] the layout, with the proof; --check writes nothing
dsr style file.R [--fix], dsr lint file.R the style guide; typos and missing functions before a run
dsr def name, dsr refs name, dsr symbols file.R the definition; every use; the outline
dsr rename old new --check the plan of a rename, with its proof
dsr call enlarge | optimize file.R:line --check (Pro) a call with all its arguments; without its defaults

More in chapter 22.

Editor Terminal What it does
Debug pipeline (code lens), Debug the Pipeline at the Cursor dsr pipe file.R:line each step: rows, columns, why records left, joins
the Follow field, a click on a key --follow 01-701-1015 one subject through the steps
try a fix, Propose the edit… --try 3 '<code>' another step 3; the file stays
dsr run prog.R --stop-on-drop 01-701-1015 stop where a record of the subject leaves
dsr run prog.R --stop-on-dup 'USUBJID' stop where the key stops being unique
Trace Function Call dsr trace file.R --call 'f(x)' [--into g] every line of one call, its values, each if

Sets for every data tool: @pipe[k], @pipe[k]:dropped, @pipe[k]:dropped:false, @pipe[k]:dropped:na, @pipe[k]:unmatched:x, @pipe[k]:unmatched:y, @pipe[k]:multiplied, @try[k]. More in chapter 23.

Key or action What it does
a click in the margin, Ctrl+F9 breakpoint
right-click the dot → Edit Condition stop only when the condition is TRUE: any(age == 65)
right-click the dot → Edit Breakpoint a hit count (3, >= 3, % 10) or a log message (BMI is {bmi})
F5 Debug R File; at a stop: continue
F10 / F11 / Shift+F11 step over / step into / step out
Stop at Line (Ctrl/Cmd+Alt+F9), Run to Cursor run to this line
R warnings in the Breakpoints view stop where a warning happens
Variables view → Break on Value Change stop after the value changes
Call Stack, Variables, Debug Console, hover the frames; their objects; R in the frame
Debug the Pipeline at the Stop the pipeline of the line, on the frame’s data
Call a Function with a Form the arguments of a function; then Debug or Trace
Debug the Run That Waits at Its Stop attach to a run that waits, for example an agent’s

Terminal: dsr run prog.R --stop-at 'FILE:LINE if <condition>' (repeat it for several stops), --stop-on-warning. More in chapter 25.

Where to stop

In the code or the call Stops
pry() every time the run reaches it
pry(when = sev == "SEVERE") when the condition is TRUE
x |> f() |> pry() |> g() in a pipeline; . is the data at that point
pry(stop = FALSE) does not stop: keeps a snapshot (points, point k)
--stop-at, --stop-on-drop, --stop-on-dup, --stop-on-warning without a change of the file
an error the frames stay open to look at

At the stop (the pry prompt of the R Console, the Pry panel, or dsr pry <command>)

Group Commands
where whereami, stack (bt), up, down, frame k
look ls, eval <code>, source <fn>; data tools on @pry:<object>
go on next [n] (n), step (s), finish (f), continue (c), quit (q)
stop later break 'FILE:LINE if <cond>', watch <expr>, unwatch
the pipeline at the line pipe, pnext, pback, pstep k, follow 01-701-1015, try 3 '<code>'
more run <file.R>, points, point k, help

Always end a live stop with continue or quit. More in chapter 24.

Command What it does
dsr test [folder | test-file.R], Run the Tests testthat in a clean R process: TESTS PASS / FAIL
dsr test --coverage (Pro), Run R File with Coverage (Pro) the lines that ran, and those that never ran
dsr coverage file.R (Pro), Clear the Coverage Marks each line with its count
dsr batch a.R b.R each program in a new R session, a .log next to it: BATCH: CLEAN / CHECK / ERROR
dsr verify prog.R (Pro) lint, run, suspicious log, fresh run: VERIFY PASS / CHECK / FAIL
dsr snapshot adsl --name before (Pro), dsr compare adsl @snapshot:before --expect AGEGR before and after a fix: ONLY THESE CHANGED

More in chapter 26.

Key or command What it does
Ctrl+Alt+A (Mac: Cmd+Alt+A), the Agent button the Agent chat
dsr agent setup [--client claude-code | copilot | codex | opencode] [--dry-run] set up a project for your agent
dsr agent doctor prove the connection
dsr next, dsr guide fix-run the next command; a playbook
dsr agent permissions data aggregate the tools give counts and summaries only

Found an error or have a question? Write to datastep.studio@gmail.com· Every program runs in DataStep Studio for R, the R extension for VS Code and Positron.

Data: the CDISC pilot study (cdiscpilot01), from the R packagespharmaversesdtm andpharmaverseadam (Apache License 2.0).

R is a project of the R Foundation. SAS and all other SAS Institute Inc. product or service names are registered trademarks or trademarks of SAS Institute Inc. This book is not affiliated with or endorsed by SAS Institute Inc. or the R Foundation. CDISC, SDTM and ADaM are trademarks of the Clinical Data Interchange Standards Consortium.

© 2026 DataStep Labs. All rights reserved.