步驟
- 步驟一:在自己目錄下創建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_fortranR
進入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()