Search code examples
pythonranacondapackage-managersminiconda

Is it possible to install R in miniconda?


I stumbled on this post:

Install of R in miniconda

https://community.rstudio.com/t/install-of-r-in-miniconda/19755

Is it possible to install R in miniconda? As I understand it miniconda is a package manager for Python only according to this definition:

Miniconda

Miniconda is a free minimal installer for conda. It is a small, bootstrap version of Anaconda that includes only conda, Python, the packages they depend on, and a small number of other useful packages, including pip, zlib and a few others. Use the conda install command to install 720+ additional conda packages from the Anaconda repository.

https://docs.conda.io/en/latest/miniconda.html

Or is it possible to use it with R?

I know Anaconda 3 offers R support.

Thanks.


Solution

  • Miniconda (the light, non-GUI version of Anaconda) gives you access to conda on the command line, and with that you can install R, along with some common packages, as follows:

    conda install r r-essentials --channel conda-forge
    

    And any further R packages you need:

    conda install r-<package-name> --channel conda-forge
    

    The "Conda" ecosystem is language-agnostic, it delivers whatever you ask for (if it exists in the repository) and installs the necessary platform binaries, but I would suggest creating a virtual environment specific to each "language platform", to ensure isolation.

    Example:

    conda create -n r_env r-essentials r-base
    
    conda activate r_env
    
    conda list
    

    And work within this environment to run R and install new packages.

    To leave the virtual environment:

    conda deactivate