R, Python: install packages on rpy2

前端 未结 3 1460
南旧
南旧 2020-12-08 12:34

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?

3条回答
  •  死守一世寂寞
    2020-12-08 12:56

    How about this

    >>> import rpy2.interactive as r
    >>> r.importr("utils")
    >>> package_name = "DirichletReg"
    >>> r.packages.utils.install_packages(package_name)
    

提交回复
热议问题