R包安装方法汇总

一、直接安装

install.packages("package name")


二、BiocManager安装--

if (!requireNamespace("BiocManager", quietly = TRUE))
  install.packages("BiocManager")
BiocManager::install("package name")
注意:有时候可根据回显添加force = TRUE

三、git_hub安装

library(devtools)
devtools::install_github("包创作者/package name")
library(remotes)
remotes::install_github("包创作者/package name") 

四、https://anaconda.org  搜索包安装方法

五:本地安装

download.file("https://cran.r-project.org/src/contrib/Archive/rvcheck/rvcheck_0.1.8.tar.gz","rvcheck_0.1.8.tar.gz") 
install.packages(rvcheck_0.1.8.tar.gz, repos = NULL, type="source")

六:找到R包下载地址后安装

url <- "https://cran.r-project.org/src/contrib/Archive/rvcheck/rvcheck_0.1.8.tar.gz"
install.packages(url,repos = NULL,type = "source")

七、命令行安装

在shell的终端
sudo R CMD INSTALL package.tar.gz

八、在CRAN中检索R包:CRAN Packages By Name (r-project.org)

九、其他操作

1.packageVersion("包“)

2.install.packages("包“,upgrade=TRUE)

3.remove.packages("包")

4.installed.packages()

5.

自己遇到的一些难搞的包安装方法:

1.scater

if(!require(scater))

devtools::install_github("davismcc/scater",build_vignettes=TRUE)

2.metap

conda install -c conda-forge r-metap

3.scRNA.seq.funcs

install_github("hemberg-lab/scRNA.seq.funcs")

安装不成功问题总结:

1.依赖的其它包没有安装

2.和R/conda版本不兼容

3.和系统不兼容

4.各种安装方法均试一遍,看哪种合适

5.删除包后重新安装

6.服务器卡

现成安装代码(不一定成,需要多试,里面有一些是其它包的依赖包)

1、install.packages

install.packages("stringi")
install.packages("ggplot2")
install.packages("pls")
install.packages("ggthemes")
install.packages("ggrepel")
install.packages("readxl")
install.packages("writexl")
install.packages("reshape2")
install.packages("pheatmap")
install.packages("RColorBrewer")
install.packages("remotes")
install.packages("ggpubr")
install.packages("corrplot")
install.packages("ggcorrplot")
install.packages("xml2")
install.packages("https://cran.r-project.org/src/contrib/Archive/xml2/xml2_1.3.2.tar.gz",repos = NULL,type = "source")
install.packages("nloptr")
install.packages("hrbrthemes")
install.packages("curl")
install.packages("https://cran.r-project.org/src/contrib/curl_4.3.2.tar.gz",repos = NULL,type = "source")
install.packages("httr")
install.packages("openssl") # https://github.com/openssl/openssl
install.packages("ComplexHeatmap")
install.packages("formattable")
install.packages("rstan")
install.packages("optparse")
install.packages("tidyverse")
install.packages("rvest")
install.packages("multiUS", repos="http://R-Forge.R-project.org")
install.packages("https://cran.r-project.org/src/contrib/Archive/locfit/locfit_1.5-9.4.tar.gz",repos = NULL,type = "source")
install.packages("https://cran.r-project.org/src/contrib/Archive/ArgumentCheck/ArgumentCheck_0.10.2.tar.gz",repos = NULL,type = "source")
install.packages("RCircos") # 环形图
install.packages("https://cran.r-project.org/src/contrib/Archive/rvcheck/rvcheck_0.1.8.tar.gz",repos = NULL,type = "source")
install.packages("ggalt") # 平滑折线图
install.packages ("githubinstall")
install.packages ("pacman")
install.packages("showtext") # 更改字体
install.packages("shadowtext") # 更改字体
install.packages("googleway") # 地图
install.packages("lubridate") # 日期转换
install.packages("networkD3") # 3D网络图
install.packages("IDPmisc") # https://www.rdocumentation.org/packages/IDPmisc/versions/1.1.20
install.packages("do")
install.packages("plotly") # 交互式绘图
install.packages("dygraphs")
install.packages("DT")
install.packages("echarts4r") # 版本可能存在问题
install.packages("WGCNA")
install.packages("psych") # 计算相关性
install.packages("AnnoProbe") # 用于下载GEO数据集并注释
install.packages("argparser")
install.packages("umap")
install.packages("survival")
install.packages("survminer")
install.packages("emmeans")
install.packages("factoextra") # https://github.com/kassambara/factoextra
install.packages("NMF") # 非负矩阵分解(nonnegative matrix factorization)
install.packages("chemometrics")
install.packages("compositions")
install.packages("msigdbr")
install.packages("gProfileR") # ID转换
install.packages("fdrci") # p值校正
install.packages("maxstat")
install.packages("fpc") # 计算K-means聚类推荐聚类数
install.packages("mice") # 多重插补
install.packages("ggdendro")
install.packages("svglite") # 保存图片为sv

2、BiocManager::install

if (!requireNamespace("BiocManager", quietly = TRUE))
 install.packages("BiocManager")

BiocManager::install("clusterProfiler")
BiocManager::install("impute")
BiocManager::install("limma")
BiocManager::install("DEP")
BiocManager::install("SummarizedExperiment",force = TRUE)
BiocManager::install("edgeR")
BiocManager::install("DESeq2")
BiocManager::install("org.Hs.eg.db")
BiocManager::install("pathview")
BiocManager::install("AnnotationDbi")
BiocManager::install("IPO")
BiocManager::install("xcms")
BiocManager::install("KEGGREST",force = TRUE)
BiocManager::install("fmcsR")
BiocManager::install("Cairo")
BiocManager::install("ComplexHeatmap")
BiocManager::install("DLBCL")
BiocManager::install("BioNet")
BiocManager::install("RSQLite")
BiocManager::install("DirichletMultinomial",force = TRUE)
BiocManager::install("chimeraviz") # 融合基因分析结果可视化
BiocManager::install("ballgown") # 分析转录组差异表达
BiocManager::install("genefilter",force = T) # methods for filtering genes from high-throughput experiments
BiocManager::install("ChIPpeakAnno")
BiocManager::install("RMassBank")
BiocManager::install("ChIPseeker")
BiocManager::install("GSVA") # 基因集变异分析(Gene Set Variation Analysis,GSVA)
BiocManager::install("ConsensusClusterPlus") # 一致性聚类
BiocManager::install("statTarget") # 质控
BiocManager::install("cmapR") # https://bioconductor.org/packages/release/bioc/html/cmapR.html
BiocManager::install("TCGAbiolinks") # 下载TCGA数据

3、devtools::install_github

devtools::install_github("strengejacke/sjmisc")
devtools::install_github("kassambara/ggpubr")
devtools::install_github("cran/nloptr@1.2.2.3")
devtools::install_github("jokergoo/ComplexHeatmap")
devtools::install_github("https://github.com/cran/RbioRXN.git")
devtools::install_github('cytoscape/r-cytoscape.js@v0.0.7') # 提示更新相关包选项时我选择了3: None
devtools::install_github("xia-lab/OptiLCMS", build = TRUE, build_vignettes = FALSE, build_manual =TRUE)
devtools::install_github("kumine/myplot")
devtools::install_github("stan-dev/rstantools")
devtools::install_github("davidaknowles/leafcutter/leafcutter") # 可变剪切分析
devtools::install_github("alyssafrazee/RSkittleBrewer") # 颜色主题
devtools::install_github("kendomaniac/docker4seq", ref="master")
devtools::install_github("ropensci/magick")
devtools::install_github("schymane/ReSOLUTION")
devtools::install_github("dkahle/ggmap") # 绘制地图 https://github.com/dkahle/ggmap
devtools::install_github("ropensci/rnaturalearth") # 世界地图 https://github.com/ropensci/rnaturalearth
devtools::install_github("outbreak-info/R-outbreak-info") # https://github.com/outbreak-info/R-outbreak-info
devtools::install_github("ramnathv/rCharts") # 交互式绘图
devtools::install_github("yihui/recharts") # 交互式绘图
devtools::install_github("ropensci/plotly") # 交互式绘图
devtools::install_github("timelyportfolio/d3treeR")
devtools::install_github("liamgilbey/ggwaffle") # 方块图/热图
devtools::install_github("https://github.com/CDK-R/rcdklibs")
devtools::install_github("https://github.com/CDK-R/cdkr", subdir="rcdk")
devtools::install_github("seandavi/GEOquery") # https://github.com/seandavi/GEOquery
devtools::install_github("therneau/survival") # https://github.com/therneau/survival
devtools::install_github("dgrapov/CTSgetR") # https://github.com/dgrapov/CTSgetR 化合物ID转换
devtools::install_github("adam-sam-brown/ksRepo") # https://github.com/adam-sam-brown/ksRepo
devtools::install_github("cBioPortal/cgdsr") # https://github.com/cBioPortal/cgdsr/blob/master/README.md

4、 remotes::install_github

remotes::install_github("YuLab-SMU/ggtree") 
remotes::install_github("SVA-SE/kilde")  # sample_data函数
remotes::install_github("SymbolixAU/googlePolylines")
remotes::install_github("SymbolixAU/googleway")
remotes::install_github("rvlenth/emmeans", dependencies = TRUE, build_opts = "") # https://github.com/rvlenth/emmeans
remotes::install_github("YuLab-SMU/createKEGGdb")

5、MetaboAnalystR

​​​​​​​

Step 1. Install package dependencies

================== Option 1 ==================
Enter the R function (metanr_packages) and then use the function. A printed message will appear informing you whether or not any R packages were installed.

metanr_packages <- function(){
metr_pkgs <- c("impute", "pcaMethods", "globaltest", "GlobalAncova", "Rgraphviz", "preprocessCore", "genefilter", "SSPA", "sva", "limma", "KEGGgraph", "siggenes","BiocParallel", "MSnbase", "multtest", "RBGL", "edgeR", "fgsea", "devtools", "crmn")
list_installed <- installed.packages()
new_pkgs <- subset(metr_pkgs, !(metr_pkgs %in% list_installed[, "Package"]))
if(length(new_pkgs)!=0){if (!requireNamespace("BiocManager", quietly = TRUE))
        install.packages("BiocManager")
        BiocManager::install(new_pkgs)
        print(c(new_pkgs, " packages added..."))
    }

if((length(new_pkgs)<1)){
        print("No new packages added...")
    }
}

metanr_packages()

================== Option 2 ==================
Use the pacman R package (for those with >R 3.5.1).

install.packages("pacman")
library(pacman)
pacman::p_load(c("impute", "pcaMethods", "globaltest", "GlobalAncova", "Rgraphviz", "preprocessCore", "genefilter", "SSPA", "sva", "limma", "KEGGgraph", "siggenes","BiocParallel", "MSnbase", "multtest", "RBGL", "edgeR", "fgsea"))

Step 2. Install the package

================== Option A) Install the package directly from github using the devtools package.==================
# Step 1: Install devtools
install.packages("devtools")
library(devtools)

# Step 2: Install MetaboAnalystR without documentation
devtools::install_github("xia-lab/MetaboAnalystR", build = TRUE, build_vignettes = FALSE)

# Step 2: Install MetaboAnalystR with documentation
devtools::install_github("xia-lab/MetaboAnalystR", build = TRUE, build_vignettes = TRUE, build_manual =T)

================== Option B) Install from a pre-built source package ==================
install.packages("https://www.dropbox.com/s/pp9vziji96k5z5k/MetaboAnalystR_3.2.0.tar.gz", repos = NULL, method = "wget")

================== Option C) Clone Github and install locally ==================
git clone https://github.com/xia-lab/MetaboAnalystR.git
R CMD build MetaboAnalystR
R CMD INSTALL MetaboAnalystR_3.2.0.tar.gz

-------------------------单细胞分析包安装----------------------

1.harmony

install.packages('harmony')
#or
library(devtools)
install_github("immunogenomics/harmony")

参考:R包安装方法及安装记录 - 知乎

  • 10
    点赞
  • 55
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
安装bioNet有多种方法,具体取决于你的需求和喜好。 方法一: 你可以通过使用devtools直接从Github上安装bioNet。首先,你需要安装devtools:install.packages("devtools"),然后加载这个:library(devtools)。接下来,你可以使用以下命令安装bioNet(无需安装文档):devtools::install_github("BioNet-Team/bionet", build = TRUE, build_vignettes = FALSE)。如果你想安装包括文档的完整版本,你可以使用以下命令:devtools::install_github("BioNet-Team/bionet", build = TRUE, build_vignettes = TRUE, build_manual = TRUE)。 方法二: 你还可以从CRAN存档中下载bioNet安装文件。你可以使用以下命令下载安装文件:url <- "https://cran.r-project.org/src/contrib/Archive/bioNet/bioNet_1.0.tar.gz",然后使用以下命令安装包:install.packages(url, repos = NULL, type = "source")。 方法三: 如果你有bioNet的预编译源代码,你可以使用以下命令安装:install.packages("path/to/bioNet.tar.gz", repos = NULL, type = "source")。 请注意,根据你的R语言版本和操作系统,可能需要进行一些额外的设置和依赖项安装。在安装过程中,你可能需要在R环境中设置正确的路径。 总结起来,要在R语言安装bioNet,你可以选择使用devtools从Github上安装或者从CRAN存档中下载安装文件。你也可以使用预编译源代码进行安装。具体的安装方法取决于你的需求和喜好。<span class="em">1</span><span class="em">2</span><span class="em">3</span> #### 引用[.reference_title] - *1* *2* *3* [R安装方法汇总](https://blog.csdn.net/Charlotteoqq/article/details/131838447)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_1"}}] [.reference_item style="max-width: 100%"] [ .reference_list ]

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值