简体   繁体   中英

How is to add R and Rtools paths in the environment variable?

I have installed R-3.5.1 and Rtools35.exe . But I am unable to install packages in R . Somewhere I got,

Make sure the R and Rtools paths are added in the environment variable.

But I don't know what is environment variable and how is to add R and Rtools paths in the environment variable?

Edit

The answer provided How to add Rtools\\bin to the system path in R requires library(devtools) . But install.packages("devtools") isn't working.

Installing package that has heavy dependencies just to set environment variables doesn't seem to be good solution.

Below solution is for R 4.0.0 and rtools40.

This uses powershell bash, it should be available on all recent Windows versions.

$ENV:PATH = "C:\R\bin;C:\rtools40\usr\bin;$ENV:PATH"

You can see full R 4.0.0 setup on Windows in this CI yaml .


Note that in powershell it is best to refer to applications using .exe suffix, because powershell has many aliases, so using R or curl will not do what you expect, you need R.exe or curl.exe instead.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM