PATH
For VScode, R needs to be on the PATH (locations where executables are found).
You can check this in the Terminal, also known as console, shell, bash, cmd.
For most other things (like git add -A or git clean -fd), you can use the terminal built into your IDE (RStudio, VScode).
For this particular check, I suggest using a clean OS-provided terminal:
Mac OS
- search (
CMD+SPACE) for “Terminal” - run the command
R - if it succeeds, it shows the R version and other info
- quit with
q("no")
Windows
- search (
Windows key) for “Terminal” - run the command
R.exe(if not using the Windows Powershell, justR) - if it succeeds, it shows the R version and other info
- quit with
q("no") - if R is not found / recognized, add it to the system (not user) PATH:
- copy the path where you installed R - or - in RStudio -> Tools -> Global Options,
copy the path (e.g.
C:\Program Files\R\R-4.5.1) - search (
Windows key) for “env”, click “Edit the system environment variables”, then “Environment Variables” (guide with images) - under “System Variables” (in the bottom half) double click on “Path”
- click “New” and copy-paste your installation location (if from RStudio, add
\binat the end) - close the variable windows + the terminal, open a new one and try
R/R.exeagain.
Potentially restart Windows inbetween.
- copy the path where you installed R - or - in RStudio -> Tools -> Global Options,
copy the path (e.g.