美文网首页
Linux 系统上安装R及R包

Linux 系统上安装R及R包

作者: 吕强强学生信 | 来源:发表于2022-05-05 16:59 被阅读0次

    因为安装Hic-Pro,需要依赖几个R包,比如ggplot2,又依赖>4.0的R,之前安的3.6,再重新安装一遍最新的吧,记录一下,省去了以后再重复查资料的过程。

    一、先是官网上选择适合自己服务器的R:

    https://cran.r-project.org/

    二、下载并解压

    wget https://cran.r-project.org/src/base/R-4/R-4.2.0.tar.gz

    tar -zxvf R-4.2.0.tar.gz

    ./configure --with-pcre1

    make  #会编译好久

    三、然后加载R包

    进入bin目录下:

    ./R

    > install.packages("BiocManager")

    > install.packages('ggplot2')

    > install.packages('RColorBrewer')

    > q()

    Save workspace image? [y/n/c]: n

    新安装的R包会默认的放到library目录下.

    四、可能会遇见的镜像问题:

    Warning: unable to access index for repository https://mirrors.bfsu.edu.cn/CRAN/src/contrib:

      cannot open URL 'https://mirrors.bfsu.edu.cn/CRAN/src/contrib/PACKAGES'

    Warning message:

    package ‘BiocManager’ is not available for this version of R

    一开始我以为是R版本的问题,转眼一想,我从3升到4,主要是为了安装ggplot2,这个就是依赖版本4的,那换镜像,于是重新选择镜像,从Beijing换到了Guangzhou,再安装R包,问题解决。注意,安装ggplot2需要时间会比较长。

    参考:https://www.cnblogs.com/shanyr/p/11427876.html

    本文使用 文章同步助手 同步

    相关文章

      网友评论

          本文标题:Linux 系统上安装R及R包

          本文链接:https://www.haomeiwen.com/subject/enrzyrtx.html