csdacac
csdacac

Reputation: 117

Install R packages from Windows 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.

Upvotes: 4

Views: 9640

Answers (2)

user20000804
user20000804

Reputation: 1

Use this command on Windows PowerShell

winget install -e --id Microsoft.ROpen

https://winget.run/search?query=r

Upvotes: -1

TarasB
TarasB

Reputation: 2428

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

Upvotes: 9

Related Questions