r Install the source package to install the local r package

To summarize, manually install R packages - Jianshu (jianshu.com) icon-default.png?t=N7T8https://www.jianshu.com/p/2a7a36414734


#BiocManager::install("simplifyEnrichment")
#BiocManager::install("EnsDb.Hsapiens.v86")


#下载包 之后 手动安装
#install.packages("~/datasets/EnsDb.Hsapiens.v86_2.99.0.tar.gz", repos = NULL, type = "source")



#remotes::install_github("HaojiaWu/plot1cell",dependencies = TRUE)
library(plot1cell)

 

When installing R packages in R language, you will always encounter installation errors. In fact, many times it is caused by the mismatch between the R language version and the R package version. At this time, you need to manually install the R package yourself. I checked a lot. There are many and complicated methods in web articles. Let’s summarize them now.

No matter which method you use, you need to first go to the R package official website to find the link to the R package version you want to download. The
R official website link:
https://www.r-project.org
Select the mirror closest to you: https://mirrors. tongji.edu.cn/CRAN/Find
Packages -> Table of available packages, sorted by name

The first method:
Download the R package locally, and then install it in R.
Reference link:
https://blog.csdn.net/weixin_30832143/article/details/94986731

setwd("F:\\CNV\\Paper\\Case-control\\mHMM")#设置本地路径
install.packages("mHMM_1.0.zip",repos=NULL)#安装

Newbies don’t like this kind of thing very much, and it’s very troublesome to change the interface.

The second method:
highly recommended, download and install the R package directly in R. Xiaobai didn't know that software could be downloaded in R at first, so he downloaded it manually and silently, which made him cry stupidly and feel aggrieved╮(╯_╰)╭.
Thanks to this friend, article link:
https://zhuanlan.zhihu.com/p/129331377

download.file("https://cran.r-project.org/src/contrib/Archive/amap/amap_0.6.tar.gz","amap_0.6.tar.gz")#下载R包
install.packages("amap_0.6.tar.gz",repos=NULL)#安装

The third method:
If you like to use the terminal, you can use the shell command in the terminal to download the R package and then install it.
The disadvantage is that you need to know the absolute path of the library of the R package, which is a bit demanding for newbies who are just starting out, 嘤嘤嘤〒▽〒.
In fact, the absolute path to the library of the R package is included in the report result returned by the installation software.

install.packages("stringi")

uploading.4e448015.gif

Uploading...re-upload canceled

Installation report

After knowing the absolute path, use the shell command in the terminal to download the R package and compile it.

wget -c https://cran.r-project.org/src/contrib/Archive/stringi/stringi_1.0-1.tar.gz#下载R包
R CMD INSTALL -l  /path/to/your/library  /path/to/your/downloaded/package #编译

The fourth method:
If you use a personal computer and have an R interface, you can actually operate it through the interface and visually install the R package manually. It is relatively stupid and suitable for friends outside the industry who are more novice than novices. What I show here is for mac os system, windows should be similar.
Open R -> Packages & Data -> Package Installer

uploading.4e448015.gif

Uploading...re-upload canceled

Find Package Installer

Enter the missing R package and click get list

uploading.4e448015.gif

Uploading...re-upload canceled

Find R package version

Select the R package that needs to be installed and click Install Selected to install it.

uploading.4e448015.gif

Uploading...re-upload canceled

Install



Author: Yin Xiaoao
Link: https://www.jianshu.com/p/2a7a36414734
Source: Jianshu
Copyright belongs to the author. For commercial reprinting, please contact the author for authorization. For non-commercial reprinting, please indicate the source.

Guess you like

Origin blog.csdn.net/qq_52813185/article/details/130871280