RStudioの設定
RStudioはそのままでも使えるが、少しカスタマイズするとより使い勝手が良くなる。RStudioのカスタマイズ画面はTools > Global Optionsをクリックすることで表示される。
以下の設定はNIIオンライン分析システムで使用可能なRStudio最新版 (RStudio Server 2021.09.1+372)の設定であり、宋の設定と同じである。
1 General
- Restore .RData into workspace at startupのチェックを消す。
- Save workspace to .RData on exit:をNeverに変更する。
- Always save history (even when not saving .RData)のチェックを消す。
2 Code
2.1 Editingタブ
- Insert spaces for tabのチェックを付ける。
- Tab widthは2、または4を指定する。
- Auto-detect code indentationのチェックを付ける。
- Insert matching parens/quotesのチェックを付ける。
- Auto-indent code after pasteのチェックを付ける。
- Vertically align arguments in auto-indentのチェックを付ける。
- Always save R scripts before sourcingのチェックを付ける。
- Ctrl + Return executes:をMulti-line R statementに変更する。
2.2 Displayタブ
- Highlight selected wordのチェックを付ける。
- Highlight selected lineのチェックを付ける。
- Show line numbersのチェックを付ける。
- Show syntax highlighting in console inputのチェックを付ける。
- Highlight R function callsのチェックを付ける。
- Rainbow parenthesesのチェックを付ける。
2.3 Savingタブ
- Default text encoding:のChangeをクリックし、UTF-8を選択する。
2.4 Completionタブ
- Show code completion:をAutomaticallyに変更する。
- Allow automatic completions in consoleのチェックを付ける。
- Insert parentheses after function completionsのチェックを付ける。
- Show help tooltip after function completionsのチェックを付ける。
- Insert spaces around equals for argument completionsのチェックを付ける。
- Use tab for autocompletionのチェックを付ける。
3 Console
- Show syntax highlighting in console inputのチェックを付ける。
4 Appearance
- 自分の好みのものを選択する。ただし、小さすぎる文字サイズ (font size) は推奨しない。目に優しくないだけでなく、誤字脱字が見つけにくくなる。
5 Pane Layout
- 左上: Source
- 右上: Console
- 左下: 全てチェックを消す。
- 左下: 全てチェックを付ける。
6 R Markdown
- Show output preview in:をViewer Paneに変更する。
- Show output inline for all R Markdown documentsのチェックを消す。
設定が終わったら右下のOK、またはApplyをクリックする。