I'm using R
in my Python script through the rpy2
library and I need a package that is not in the default installation of R. How can I install it?
install.packages("DirichletReg", repos="http://r-forge.r-project.org")
won't work.
On Python:
>>> install.packages("DirichletReg", repos="http://r-forge.r-project.org")
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
NameError: name 'install' is not defined
And from R:
> install.packages("DirichletReg", repos="http://r-forge.r-project.org")
Installing package(s) into ‘/usr/local/lib/R/site-library’
(as ‘lib’ is unspecified)
Warning message:
In getDependencies(pkgs, dependencies, available, lib) :
package ‘DirichletReg’ is not available (for R version 2.14.1)
How about this
Ricardo's answer no longer works.
To install from Python:
That
utils
package is theR.utils
package whose documentation can be found here: https://CRAN.R-project.org/package=R.utilsAs of my last edit, the documentation still says to do this.