我确信这是一个微不足道的问题,但我试图在Linux中安装多个R版本。我不是使用R工作室服务器pro,而是使用免费的R工作室服务器。我跟踪这个文档来安装R,但是当我试图定位它时却发现了错误。但是,当我运行一个命令来查看安装了哪个版本的R时,没有出现错误。
R安装好了!
(base) noah@noah-VirtualBox:/opt/R/4.1.3$ /opt/R/4.1.3/bin/R --version
R version 4.1.3 (2022-03-10) -- "One Push-Up"
Copyright (C) 2022 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)
R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under the terms of the
GNU General Public License versions 2 or 3.
For more information about these matters see
https://www.gnu.org/licenses/.尝试
(base) noah@noah-VirtualBox:/opt/R/4.1.3$ R
Command 'R' not found, but can be installed with:
sudo apt install r-base-core(base) noah@noah-VirtualBox:/opt/R/4.1.3$ which R
(base) noah@noah-VirtualBox:/opt/R/4.1.3$ 复制步骤
export R_VERSION=4.1.3
curl -O https://cran.rstudio.com/src/base/R-4/R-${R_VERSION}.tar.gz
tar -xzvf R-${R_VERSION}.tar.gz
cd R-${R_VERSION}# Build and install R
./configure \
--prefix=/opt/R/${R_VERSION} \
--enable-memory-profiling \
--enable-R-shlib \
--with-blas \
--with-lapackmake
sudo make install# Verify R installation
/opt/R/${R_VERSION}/bin/R --version# Create a symlink to R
sudo ln -s /opt/R/${R_VERSION}/bin/R /usr/local/bin/R
sudo ln -s /opt/R/${R_VERSION}/bin/Rscript /usr/local/bin/Rscript# Export path so Rstudio can find it
export RSTUDIO_WHICH_R='/opt/R/4.1.3/bin'发布于 2022-05-25 03:11:51
你搞得太复杂了。只需安装,比如说,
/opt/R/4.2.0/
/opt/R/4.1.2/
/opt/R/4.0.5/然后将$PATH设置为您想要的版本中的bin/目录,或者直接调用R。这正是我们很多人对R的两个版本(即R-release和R-devel)所做的:
$ R --version | head -1
R version 4.2.0 (2022-04-22) -- "Vigorous Calisthenics"
$
$ /usr/lib/R/bin/R --version | head -1
R version 4.2.0 (2022-04-22) -- "Vigorous Calisthenics"
$
$ /usr/local/lib/R-devel/bin/R --version | head -1
R Under development (unstable) (2022-05-24 r82398) -- "Unsuffered Consequences"
$ 前两个是相同的,因为这是我的‘默认’版本。第三位是我的另一位。这就是它的全部。
https://stackoverflow.com/questions/72371110
复制相似问题