settings
There are a few RStudio settings (reference)
that should be changed for reproducibility,
and several more that I suggest for ease of use.
You can set them manually (see below) or run
this script:
I also suggest to set several keyboard shortcuts
with the rskey quick setup,
or a few manually at Tools -> Modify Keyboard Shortcuts (search with part of the name):
- “toggle soft wrap mode”: set to e.g.
ALT + W(Windows) orcontrol + W(Mac) - “paste last yank”: remove
CTRL + Yso it means “redo” as in other programs - “set working directory to current document’s directory: set to e.g.
CTRL + H
To manually change RStudio settings if you don’t want to run the script,
go to Tools -> Global Options:
- ->
General->Basic- OFF: Restore .Rdata into workspace at startup
- Save workspace to .RData on exit: NEVER
- OFF: Always save history (even when not saving .RData)
- Rather restore the results of long computations manually if needed.
- OFF: Restore .Rdata into workspace at startup
- ->
Code->Display- ON: Highlight R function calls
- ON: Use rainbow parentheses
- ->
Code->Saving- Default Text Encoding: UTF-8
- ON: Ensure that source files end with newline
- ->
Console- ON: Show syntax highlighting in console input
- ->
Packages->Development- ON: Save all files before building a package
- ->
R Markdown- Show output preview in: Viewer Pane
- not in menu, only per code:
# Hide hidden files (.git, .Rproj.user, ...) when "Show hidden files" is off:
rstudioapi::writeRStudioPreference("always_shown_extensions", list())
rstudioapi::writeRStudioPreference("always_shown_files", list())matter of taste:
- ->
Appearance- Editor theme: Cobalt
my preferences, skip if unsure:
- ->
General->Advanced - ->
Code->Editing- OFF: Auto-indent code after paste - if you have a custom indenting scheme
- OFF: Enable Code snippets - if they annoy you
- ->
Code->Saving- Line ending conversion: posix (LF) - compatible across OS platforms
- ->
Sweave- Weave Rnw files using: knitr - for Rnw documents (use quarto instead now)
- ->
Spelling- OFF: Use real time spell-checking - if it annoys you
- ->
Terminal(Windows only)- New terminals open with: Windows PowerShell - to enable
CTRL + Vin the terminal
- New terminals open with: Windows PowerShell - to enable
- not in menu, only per code: