R --- Error in library(***) : there is no package called ‘***’ (服务器非root用户)

步骤

      • 步骤一:在自己目录下创建R包安装路径
      • 步骤二:配置用户本地的R库路径
      • 步骤三:安装缺失的包(在终端)
      • 步骤四:验证安装

步骤一:在自己目录下创建R包安装路径

mkdir -p ~/R_libs

步骤二:配置用户本地的R库路径

在家目录下,编辑(或新建).Renviron文件:

vim ~/.Renviron

在文件内写入如下内容: R_LIBS_USER=~/R_libs,保存后退出。

步骤三:安装缺失的包(在终端)

在终端运行:

module add apps/R/4.3.2
module add compiler/gnu/8.3.0_fortran

R

进入R后,执行:

install.packages('mice', repos='http://mirrors.tuna.tsinghua.edu.cn/CRAN')
install.packages('lme4', repos='http://mirrors.tuna.tsinghua.edu.cn/CRAN')
install.packages('lmerTest', repos='http://mirrors.tuna.tsinghua.edu.cn/CRAN')
install.packages('piecewiseSEM', repos='http://mirrors.tuna.tsinghua.edu.cn/CRAN')
install.packages('openxlsx', repos='http://mirrors.tuna.tsinghua.edu.cn/CRAN')
install.packages('dplyr', repos='http://mirrors.tuna.tsinghua.edu.cn/CRAN')
install.packages('ggplot2', repos='http://mirrors.tuna.tsinghua.edu.cn/CRAN')
install.packages('DiagrammeR', repos='http://mirrors.tuna.tsinghua.edu.cn/CRAN')
install.packages('sjPlot', repos='http://mirrors.tuna.tsinghua.edu.cn/CRAN')

步骤四:验证安装

退出R:

quit()

你可能感兴趣的:(r语言,服务器)