This repository includes instructions and examples to work with R on Visual Studio Code (VS Code).
Follow instructions on Setting up Visual Studio Code.
In particular, you can conveniently install VS Code on GNU/Linux using
snap
by issuing the following command (works fine if you are on
Ubuntu):
sudo snap install --classic code
Open a terminal. Then, clone this repository:
git clone [email protected]:telostat/vscode-example-R.git
Once it is cloned, change to the root directory of the repository:
cd vscode-example-R
Install following R packages:
install.packages(c("languageserver", "lintr", "rex"))
Finally, run VS Code on the root directory (note the .
after code
command):
code .
Once VS Code has started, you may be prompted to install recommended extensions in case that you have not installed them yet.
See .vscode/extensions.json
for recommended
extensions (not only for R). One of them is commented out: Emacs Keybindings.
Enable it if you are used to Emacs keybindings.
- Example RMarkdown file:
./document.Rmd
- Library file:
./library.R
- Program file:
./execute.R