Rstudio in anaconda environment: how should I install R packages?
Anaconda is a package manager/self-contained workspace and should be used to install packages if using R through a conda environment.
To install desolve, you'll want to run the below from your conda environment. You can search for the conda availability of an R package here: https://anaconda.org/conda-forge
conda install -c conda-forge r-desolve
In my experience, conda-forge often has more updated versions of R packages and one should look there first for the install.
Why does using conda to install rstudio, r version 4, using conda on my linux system return an error about incompatable specifications?
Looks like an issue with dependencies, as rstudio
does not seem to be solvable with r-base=4.0.*
specified.
This works:
conda create -c conda-forge -n r4rs r-base rstudio
This does not:
conda create -c conda-forge -n r4rs r-base=4.0.* rstudio
Probable reason might be that the rstudio
package in the conda channel is not very actively maintained and hasn't seen an update in over a year, see here
Depending on what can give here, you could:
Accept the option of
conda create -c conda-forge -n r4rs r-base rstudio
which will give your-base<4.0
Download and install your own version of
rstudio
from the official website and create an environment with justr-base==4.0.*
, activate that env and then start your downloaded rstudio, which should detect ther
you have installed into the conda env. See also this post
Can't install recent version of Rstudio in Ubuntu 22.04 through anaconda
Don't use the r
channel - Anaconda has not kept up maintenance on it. Instead, use Conda Forge. Also, I would strongly discourage installing anything R in an Anaconda base environment or any other environment that has Python installed. Instead, create a new one:
conda create -n rstudio -c conda-forge rstudio-desktop r-base=4.1
Specifying the r-base
, which controls the version, is optional but recommended. This should work for either 4.0 or 4.1.
Additional Commentary
I'm a strong advocate of keeping infrastructure and execution environments separated. This allows one to keep updating them independent. Unlike Jupyter, RStudio still doesn't have clean way to load Conda R environments. For that reason, I still recommend using a native RStudio installation, as described in this answer.
RStudio does not launch from Anaconda
I also had a lot of problems for many months trying to use RStudio with Anaconda. There were so many problems (files were sometimes not saved, new R-Environments could not be created, RStudio could not be installed, packages were not correctly loaded etc.). I found also several others in the Internet who have experiencend similar problems. This is why I just installed RStudio and the base R directly without Anaconda and so far I have not had any problems with that.
Related Topics
Print a Data Frame with Columns Aligned (As Displayed in R)
How to Always Suppress Messages in R
Saving a File to Sharepoint with R
How to Convert List of List into a Tibble (Dataframe)
Inserting a Table Under the Legend in a Ggplot2 and Saving Everything to a File
Curly Curly Tidy Evaluation and Modifying Inputs or Their Names
Convert Map Data to Data Frame Using Fortify {Ggplot2} for Spatial Objects in R
Fuzzyjoin Two Data Frames Using Data.Table
Adding Shade to R Lineplot Denotes Standard Error
Is There a Fast Parser for Date
Dplyr: Mutate_At + Coalesce: Dynamic Names of Columns
Search for Corresponding Node in a Regression Tree Using Rpart
How to Load CSV File into Sparkr on Rstudio
Setting an Individual Color Palette for the Group Variable in Geom_Smooth
Note or Warning from Package Check When Readme.Md Includes Images