Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Install R packages from Windows CMD

Tags:

windows

r

cmd

I'm trying to install two R packages from the Windows CMD. I've looked around and I can't find a completely automatic way of achieving this.

Does anyone have any ideas?

Thanks.

like image 517
csdacac Avatar asked Oct 15 '25 17:10

csdacac


1 Answers

For me it works using rscript.exe. Similar to Install binary zipped R package via command line, but that one is for a local file.

Example of getting 'igraph' package:

C:\Program Files\R\R-3.1.1\bin>RScript.exe  -e "install.packages('igraph', repos
='https://cran.rstudio.com/')"

Parameter repos has to be provided, otherwise you get error

Error in contrib.url(repos, "source") :
trying to use CRAN without setting a mirror
Calls: install.packages -> contrib.url
Execution halted

To pick a mirror you like, visit https://cran.r-project.org/mirrors.html

like image 112
TarasB Avatar answered Oct 18 '25 07:10

TarasB



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!