--- author: Christian Ayala title: Putting R in your system path --- # Putting R in your system's `PATH` environmental variable (Windows) #### By Christian Ayala, University of Arizona ## A. Locate the directory containing R executables 1. Search for **Rscript** in the search box of Windows. 2. Select **Rscript** -> **Open file location** (see figure below). ![](https://i.imgur.com/3xU3a3h.png) You should arrive to a directory that contains several executables including **Rgui**, **Rscript** and **Rcmd**. 3. Click on the **address bar** and copy the **path** to this directory. ![](https://i.imgur.com/AoolvfF.png) ## B. Adding R directory to your system's path 4. Search for **environment variables** in the search box of Windows. 5. Select **Edit the system environment variables** -> **Open**. ![](https://i.imgur.com/UPnAhut.png) 6. Click **Environment Varibles**. ![](https://i.imgur.com/oiRQHtV.png) 7. Select **Path** and click on **Edit...**. ![](https://i.imgur.com/guWZue6.png) 8. (Optional) If you have the path of and **older version** of R that you are not using anymore **select it** and click on **Delete**. ![](https://i.imgur.com/o84fX9h.png) 9. Click on **New** and paste the path to the R directory folder that you copied earlier (**Step 3**). Then click **OK** on all open Windows. ![](https://i.imgur.com/fyHzAFd.png) ![](https://i.imgur.com/vdV8gGu.png) ## C. Test that R has been added to your `PATH` environmental variable. 10. Open **Anaconda Prompt** terminal and type: ``` which Rscript ``` If it returns the path to the folder that contains the executables (the one that you arrived on **Step 2**). ![](https://i.imgur.com/WXDVQq7.png) If it returns an error, please check again that you are adding the R executables folder to your path correctly. # Questions or comments Please do not hesitate to reach me at: cayalaortiz@arizona.edu