你好,我试图做探索性分析在R部分I(Coursera课程)。我使用的是RStudio 1.2.1335版本的macOS Sierra 10.12.6。
我在安装 "org.HS.eg.db "包时遇到了问题,当我键入。
BiocManager::install("org.Hs.eg.db")
当它试图安装 "org.Hs.eg.db "时,我在控制台中得到:
installing the source package ‘org.Hs.eg.db’
trying URL 'https://bioconductor.org/packages/3.9/data/annotation/src/contrib/org.Hs.eg.db_3.8.2.tar.gz' Content type 'application/x-gzip' length 74892843 bytes (71.4 MB) ==================================================
downloaded 71.4 MB
* installing
*source
* package ‘org.Hs.eg.db’ ...
** using staged installation
** R
** inst
** byte-compile and prepare package for lazy loading
** help
*** installing help indices
** building package indices
** testing if installed package can be loaded from temporary location ** testing if installed package can be loaded from final location
** testing if installed package keeps a record of temporary installation path
* DONE (org.Hs.eg.db) The downloaded source packages are in ‘/private/var/folders/l6/kbsz4n314tdfcxphnmnj7nr80000gn/T/Rtmpb14l6K/downloaded_packages’
当我后来尝试运行时,
chr = AnnotationDbi::select(org.Hs.eg.db,keys=aeid,keytype="ENSEMBL",columns="CHR")
我在控制台中得到:
Error in AnnotationDbi::select(org.Hs.eg.db, keys = aeid, keytype = "ENSEMBL", : object 'org.Hs.eg.db' not found
您是否致电 library(org.Hs.eg.db)
首先?
安装包是不够的。当你想使用一个包中的函数对象时,你需要在你的R会话中加载它,使用 library()
:
library(org.Hs.eg.db)
chr <- AnnotationDbi::select(
org.Hs.eg.db,
keys = aeid,
keytype = "ENSEMBL",
columns = "CHR"
)
这应该可以,如果你有 AnnotationDbi
包,并安装了一个名为 aeid
在您的R会话中定义。
您可能想查看一些关于使用R和R包的教程,如 这个.
与你的问题无关的补充说明。
BiocManager::version()
. <-
在R中进行赋值(例如你正在做的创建 chr
在你的例子中)。) =
一般用于指定函数参数