Both Python and R are popular open-source languages for data science tasks. Although I prefer Python for most of the data exploration, some stakeholders prefer to work in R for specific statistical analysis and visualization. Therefore, I have installed R with Anaconda following this tutorial last February and it allowed me to control both Python and R environments with conda.
To set up R environment with Anaconda
Create a new conda environment with all the r-essentials
conda create -n r_env r-essentials r-base
Activate the environment
conda activate r_env
Update R packages
conda update r-caret
Install RStudio
conda install -c r rstudio
To install R packages using conda
To install R packages(libraries) in conda environment, add r- before the package name:
conda install r-packagename
For some modules like inspectdf cannot be installed with conda. Then try conda skeleton
to pick up the CRAN package metadata and build a new package that can be installed in any conda environment.
conda install conda-build
conda skeleton cran <something_on_cran>
conda build r-<something_on_cran_lowercased>
conda install -c local r-<something_on_cran_lowercased>