Rprofile.site

config
R
Published

October 19, 2024

Modified

November 10, 2024

初始化

~

language=en

~etc.site

Show the code
options("timeout")
options(timeout = 180)

# set a CRAN mirror
getOption("repos")
options("BioC_mirror")

# "https://mirrors.ustc.edu.cn/CRAN/"
options(repos = c(CRAN = "https://cran.rstudio.com/"))
options(BioC_mirror = "https://mirrors.tuna.tsinghua.edu.cn/bioconductor")

.First <- function() {
  library(showtext, quietly = T)
  # font_add("Times New Roman Regular", "C:/Windows/Fonts/times.ttf")
  # font_add("Times New Roman Bold", "C:/Windows/Fonts/timesbd.ttf")
  # font_add("Times New Roman Bold Italic", "C:/Windows/Fonts/timesbi.ttf")
  # font_add("Times New Roman Italic", "C:/Windows/Fonts/timesi.ttf")
  # font_add("黑体 常规", "C:/Windows/Fonts/simhei.ttf")
  # font_add("楷体 常规", "C:/Windows/Fonts/simkai.ttf")
  showtext_auto()
  # library(data.table)
  library(conflicted)
  library(tidyverse)
  library(patchwork)
  # library(BiocManager)
  library(readxl)
  library(writexl)
  conflicted::conflict_scout()
  message(today())
}


.Last <- function() {

}

如果希望永久删除安装路径,可以直接编辑R的环境配置文件(例如 .Renviron),去掉相应的路径条目,然后重启R使更改生效。

Show the code
# 更新 R Gui

# installr::updateR()

tools <- c(
  "installr", "devtools","remotes","conflicted", "reticulate", "BiocManager")


needed <- c(
  "tidyverse", "tidymodels", "readxl", "writexl","plotly","survminer",
  "ggsurvfit","arrow"
)

# remotes::install_github("jbryer/psa", build_vignettes = TRUE, dependencies = "Enhances")

optional <- c(
  "ggpubr","pROC", "ggprism", "ggpattern", 
  "pheatmap", "ggfortify", "ggrepel", "ggthemes","ggcorrplot", "ggpmisc", 
  "ggraph", "tidygraph", "svglite",
  
  
  "gt", "gtsummary", "tableone", "flextable",
)


lapply(tools, require)

安装路径

Show the code
.libPaths()

#> [1] "C:/Users/DELL/AppData/Local/R/win-library/4.4" "D:/R-4.4.1/library"  
#.libPaths(c("/envs/新路径", .libPaths()))
Show the code
.libPaths(.libPaths()[.libPaths() != "C:/Users/DELL/AppData/Local/R/win-library/4.4"])
.libPaths()