前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >R语言day4:再也不用担心R包的安装

R语言day4:再也不用担心R包的安装

原创
作者头像
不会写代码的医学生
修改2024-03-11 10:57:11
1290
修改2024-03-11 10:57:11
举报

title: "day4note"

output: html_document

date: "2024-03-09"


1.R包安装

R包理解为多个函数打包存放,包含函数、数据、帮助文件、描述文件

找所有R包使用的规律

生物信息学R包的三个来源

代码语言:r
复制
install.packages("tidyr") #CRAN网站
代码语言:r
复制
install.packages('BiocManager')  #Bioconductor网站
BiocManager::install("limma")
代码语言:r
复制
install.packages('devtools')#github网站
devtools::install_github("jmzeng1314/idmap1") #括号里写作者用户名加包名
#安装 TwoSampleMR,在bing上搜属于哪个网站
devtools::install_github("MRCIEU/TwoSampleMR")

github旧版本的包有问题

1.旧版本,需要github软件
2.从别的一安装该包的电脑上偷一个
上哪里偷
代码语言:r
复制
.libPaths()
代码语言:r
复制
## [1] "/Library/Frameworks/R.framework/Versions/4.3-x86_64/Resources/library"
找到与包同名的文件夹,编译好的R包,打包zip

发给自己

3.搬到自己电脑上
代码语言:r
复制
.libPaths()
代码语言:r
复制
## [1] "/Library/Frameworks/R.framework/Versions/4.3-x86_64/Resources/library"
解压放进去

2.实现包的快速下载

2.1下载r语言的时候设置镜像

清华镜像

http://mirrors.tuna.tsinghua.edu.cn/CRAN/

http://mirrors.tuna.tsinghua.edu.cn/bioconductor/

中科大镜像

http://mirrors.ustc.edu.cn/CRAN/

http://mirrors.ustc.edu.cn/bioc/

实现快速下载的方法

方法一:

方法二:代码设置镜像

代码语言:r
复制
options("repos"=c(CRAN="http://mirrors.tuna.tsinghua.edu.cn/CRAN/"))
options(BioC_mirror="http://mirrors.ustc.edu.cn/bioc/")

3.检查包有没有安装成功

代码语言:r
复制
library(tidyr)#安装后需加载 
library(stringr)
#library没有error,R包安装成功
require(tidyr)#返回逻辑值

3.1

代码语言:r
复制
pheatmap::pheatmap(volcano)#已经安装的包,可以用::快速调用里面的函数
代码语言:r
复制
   #当一个代码要复制三次,写成循环

4.安装包时存在提示信息

R语言版本只追求第二位最新

4.1问是否更新的、“不存在”的是依赖包

使用包里的函数,要先安装或加载包

更新一个包:取消加载,卸载,重启session,安装

如果是windows系统还会遇到,权限不够???

小理一下,,

分情况讨论

代码语言:r
复制
if(!require(stringr))install.packages("stringr")

获取帮助

代码语言:r
复制
?sd#1.快速查看函数帮助文档
#2.找R包介绍页面(直接搜)
library(limma)
browseVignettes("limma") #3.browseVignettes("")
#不是每个包都有的 #在线帮助文档
ls("package:limma") #列出一个包里都有哪些函数或数据
代码语言:r
复制
##   [1] "[.EList"                    "[.EListRaw"                
##   [3] "[.MAList"                   "[.MArrayLM"                
##   [5] "[.RGList"                   "[.TestResults"             
##   [7] "alias2Symbol"               "alias2SymbolTable"         
##   [9] "alias2SymbolUsingNCBI"      "anova.MAList"              
##  [11] "arrayWeights"               "arrayWeightsQuick"         
##  [13] "as.data.frame.EList"        "as.data.frame.EListRaw"    
##  [15] "as.data.frame.MAList"       "as.data.frame.MArrayLM"    
##  [17] "as.MAList"                  "as.matrix.EList"           
##  [19] "as.matrix.EListRaw"         "as.matrix.ExpressionSet"   
##  [21] "as.matrix.LumiBatch"        "as.matrix.MAList"          
##  [23] "as.matrix.MArrayLM"         "as.matrix.marrayNorm"      
##  [25] "as.matrix.PLMset"           "as.matrix.RGList"          
##  [27] "as.matrix.vsn"              "asMatrixWeights"           
##  [29] "auROC"                      "avearrays"                 
##  [31] "avearrays.default"          "avearrays.EList"           
##  [33] "avearrays.MAList"           "avedups"                   
##  [35] "avedups.default"            "avedups.EList"             
##  [37] "avedups.MAList"             "avereps"                   
##  [39] "avereps.default"            "avereps.EList"             
##  [41] "avereps.EListRaw"           "avereps.MAList"            
##  [43] "avereps.RGList"             "backgroundCorrect"         
##  [45] "backgroundCorrect.matrix"   "barcodeplot"               
##  [47] "beadCountWeights"           "blockDiag"                 
##  [49] "bwss"                       "bwss.matrix"               
##  [51] "camera"                     "camera.default"            
##  [53] "cameraPR"                   "cameraPR.default"          
##  [55] "cbind.EList"                "cbind.EListRaw"            
##  [57] "cbind.MAList"               "cbind.RGList"              
##  [59] "changeLog"                  "chooseLowessSpan"          
##  [61] "classifyTestsF"             "contrastAsCoef"            
##  [63] "contrasts.fit"              "controlStatus"             
##  [65] "convest"                    "coolmap"                   
##  [67] "cumOverlap"                 "decideTests"               
##  [69] "decideTests.default"        "decideTests.MArrayLM"      
##  [71] "designI2A"                  "designI2M"                 
##  [73] "detectionPValues"           "detectionPValues.default"  
##  [75] "detectionPValues.EListRaw"  "diffSplice"                
##  [77] "dim.EList"                  "dim.EListRaw"              
##  [79] "dim.MAList"                 "dim.MArrayLM"              
##  [81] "dim.RGList"                 "dimnames.EList"            
##  [83] "dimnames.EListRaw"          "dimnames.MAList"           
##  [85] "dimnames.MArrayLM"          "dimnames.RGList"           
##  [87] "dimnames<-.EList"           "dimnames<-.EListRaw"       
##  [89] "dimnames<-.MAList"          "dimnames<-.RGList"         
##  [91] "duplicateCorrelation"       "eBayes"                    
##  [93] "exprs.MA"                   "fitFDist"                  
##  [95] "fitFDistRobustly"           "fitGammaIntercept"         
##  [97] "fitmixture"                 "fitted.MArrayLM"           
##  [99] "fry"                        "fry.default"               
## [101] "genas"                      "geneSetTest"               
## [103] "getDupSpacing"              "getEAWP"                   
## [105] "getGeneKEGGLinks"           "getKEGGPathwayNames"       
## [107] "getLayout"                  "getLayout2"                
## [109] "getSpacing"                 "gls.series"                
## [111] "goana"                      "goana.default"             
## [113] "goana.MArrayLM"             "goanaTrend"                
## [115] "gridc"                      "gridr"                     
## [117] "head.EList"                 "head.EListRaw"             
## [119] "head.MAList"                "head.MArrayLM"             
## [121] "head.RGList"                "head.TestResults"          
## [123] "heatdiagram"                "heatDiagram"               
## [125] "helpMethods"                "ids2indices"               
## [127] "imageplot"                  "imageplot3by2"             
## [129] "interGeneCorrelation"       "intraspotCorrelation"      
## [131] "is.fullrank"                "isNumeric"                 
## [133] "kegga"                      "kegga.default"             
## [135] "kegga.MArrayLM"             "kooperberg"                
## [137] "labels.TestResults"         "levels.TestResults"        
## [139] "limmaUsersGuide"            "lm.series"                 
## [141] "lmFit"                      "lmscFit"                   
## [143] "loessFit"                   "logcosh"                   
## [145] "logsumexp"                  "MA.RG"                     
## [147] "ma3x3.matrix"               "ma3x3.spottedarray"        
## [149] "makeContrasts"              "makeUnique"                
## [151] "mdplot"                     "merge.EList"               
## [153] "merge.EListRaw"             "merge.MAList"              
## [155] "merge.RGList"               "mergeScansRG"              
## [157] "modelMatrix"                "modifyWeights"             
## [159] "mrlm"                       "mroast"                    
## [161] "mroast.default"             "nec"                       
## [163] "neqc"                       "nonEstimable"              
## [165] "normalizeBetweenArrays"     "normalizeCyclicLoess"      
## [167] "normalizeForPrintorder"     "normalizeForPrintorder.rg" 
## [169] "normalizeMedianAbsValues"   "normalizeMedianValues"     
## [171] "normalizeQuantiles"         "normalizeRobustSpline"     
## [173] "normalizeVSN"               "normalizeVSN.default"      
## [175] "normalizeVSN.EListRaw"      "normalizeVSN.RGList"       
## [177] "normalizeWithinArrays"      "normexp.fit"               
## [179] "normexp.fit.control"        "normexp.fit.detection.p"   
## [181] "normexp.signal"             "plotDensities"             
## [183] "plotDensities.default"      "plotDensities.EList"       
## [185] "plotDensities.EListRaw"     "plotDensities.MAList"      
## [187] "plotDensities.RGList"       "plotExonJunc"              
## [189] "plotExons"                  "plotFB"                    
## [191] "plotFB.default"             "plotFB.EListRaw"           
## [193] "plotFB.RGList"              "plotlines"                 
## [195] "plotMA"                     "plotMA.default"            
## [197] "plotMA.EList"               "plotMA.EListRaw"           
## [199] "plotMA.MAList"              "plotMA.MArrayLM"           
## [201] "plotMA.RGList"              "plotMA3by2"                
## [203] "plotMD"                     "plotMD.default"            
## [205] "plotMD.EList"               "plotMD.EListRaw"           
## [207] "plotMD.MAList"              "plotMD.MArrayLM"           
## [209] "plotMD.RGList"              "plotMDS"                   
## [211] "plotMDS.default"            "plotMDS.MDS"               
## [213] "plotPrintorder"             "plotPrintTipLoess"         
## [215] "plotRLDF"                   "plotSA"                    
## [217] "plotSplice"                 "plotWithHighlights"        
## [219] "poolVar"                    "predFCm"                   
## [221] "printHead"                  "printorder"                
## [223] "printtipWeights"            "propexpr"                  
## [225] "propTrueNull"               "protectMetachar"           
## [227] "qqf"                        "qqt"                       
## [229] "rankSumTestWithCorrelation" "rbind.EList"               
## [231] "rbind.EListRaw"             "rbind.MAList"              
## [233] "rbind.RGList"               "read.columns"              
## [235] "read.idat"                  "read.ilmn"                 
## [237] "read.ilmn.targets"          "read.imagene"              
## [239] "read.maimages"              "readGAL"                   
## [241] "readGenericHeader"          "readGPRHeader"             
## [243] "readImaGeneHeader"          "readSMDHeader"             
## [245] "readSpotTypes"              "readTargets"               
## [247] "removeBatchEffect"          "removeExt"                 
## [249] "residuals.MArrayLM"         "RG.MA"                     
## [251] "roast"                      "roast.default"             
## [253] "romer"                      "romer.default"             
## [255] "sampleInfoFromGEO"          "selectModel"               
## [257] "show"                       "spotc"                     
## [259] "spotr"                      "squeezeVar"                
## [261] "strsplit2"                  "subsetListOfArrays"        
## [263] "summary.EList"              "summary.EListRaw"          
## [265] "summary.MAList"             "summary.MArrayLM"          
## [267] "summary.RGList"             "summary.TestResults"       
## [269] "tail.EList"                 "tail.EListRaw"             
## [271] "tail.MAList"                "tail.MArrayLM"             
## [273] "tail.RGList"                "tail.TestResults"          
## [275] "targetsA2C"                 "tmixture.matrix"           
## [277] "tmixture.vector"            "topGO"                     
## [279] "topKEGG"                    "topRomer"                  
## [281] "topSplice"                  "topTable"                  
## [283] "topTableF"                  "topTreat"                  
## [285] "treat"                      "tricubeMovingAverage"      
## [287] "trigammaInverse"            "trimWhiteSpace"            
## [289] "tZscore"                    "unique.TestResults"        
## [291] "uniquegenelist"             "uniqueTargets"             
## [293] "unwrapdups"                 "vennCounts"                
## [295] "vennDiagram"                "volcanoplot"               
## [297] "voom"                       "vooma"                     
## [299] "voomaByGroup"               "voomWithQualityWeights"    
## [301] "weighted.median"            "weightedLowess"            
## [303] "wilcoxGST"                  "write.fit"                 
## [305] "wsva"                       "wtarea"                    
## [307] "wtflags"                    "wtIgnore.Filter"           
## [309] "zscore"                     "zscoreGamma"               
## [311] "zscoreHyper"                "zscoreT"

一定要学会自己解决问题

最后做个题吧~

answer:A E

引用自生信技能树课程

原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。

如有侵权,请联系 cloudcommunity@tencent.com 删除。

原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。

如有侵权,请联系 cloudcommunity@tencent.com 删除。

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
目录
  • 1.R包安装
    • R包理解为多个函数打包存放,包含函数、数据、帮助文件、描述文件
      • github旧版本的包有问题
      • 2.实现包的快速下载
        • 2.1下载r语言的时候设置镜像
        • 清华镜像
        • http://mirrors.tuna.tsinghua.edu.cn/CRAN/
        • http://mirrors.tuna.tsinghua.edu.cn/bioconductor/
        • 中科大镜像
        • http://mirrors.ustc.edu.cn/CRAN/
        • http://mirrors.ustc.edu.cn/bioc/
        • 更新一个包:取消加载,卸载,重启session,安装
          • 如果是windows系统还会遇到,权限不够???
          • 分情况讨论
          • 获取帮助
          • 一定要学会自己解决问题
          领券
          问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档