美文网首页
Github R包终极安装方法

Github R包终极安装方法

作者: 余绕 | 来源:发表于2022-12-19 17:21 被阅读0次

    1.方法1:

    # install.packages("devtools")
    devtools::install_github("Github-Yilei/ggcor")
    

    2. 方法2:

    1.下载软件包
    image.png

    2. 解压文件,并把文件夹修改成为ggcor,同时移动到R当前工作目录

    image.png
    3. 利用pkgbuild::build()构建R包
    1.安装
    
    #install.packages("pkgbuild")
    
    library(pkgbuild)
    
    pkgbuild::build("./ggcor", dest_path = ".")  
    
    #./ggcor上述文件夹,dest_path = "." 路径为当前路径
    √  checking for file 'C:\Users\TAO\Documents\ggcor/DESCRIPTION' ...
    -  preparing 'ggcor': (1.1s)
    √  checking DESCRIPTION meta-information ...
    -  checking for LF line-endings in source and make files and shell scripts
    -  checking for empty or unneeded directories
    -  building 'ggcor_0.9.8.1.tar.gz'
       
    
    image.png

    3. 安装R包

    其中遇见依赖,需要不断安装依赖,最后安上。
    > install.packages("./ggcor_0.9.8.1.tar.gz",repos = NULL,type = "source")
    
       File .Renviron contains invalid line(s)
          C:/Users/TAO/AppData/Local/Programs/Python/Python310/python.exe
       They were ignored
    
    ERROR: dependencies 'ggnewscale', 'patchwork' are not available for package 'ggcor'
    * removing 'D:/Program/R/R program/R-4.0.2/library/ggcor'
    Warning in install.packages :
      installation of package ‘./ggcor_0.9.8.1.tar.gz’ had non-zero exit status
    
    > install.packages("patchwork")
    
      There is a binary version available but the source version is later:
              binary source needs_compilation
    patchwork  1.1.1  1.1.2             FALSE
    
    installing the source package ‘patchwork’
    
    试开URL’https://cran.rstudio.com/src/contrib/patchwork_1.1.2.tar.gz'
    Content type 'application/x-gzip' length 3192018 bytes (3.0 MB)
    downloaded 3.0 MB
    ............
    
    > install.packages("ggnewscale")
    
      There is a binary version available but the source version is later:
               binary source needs_compilation
    ggnewscale  0.4.7  0.4.8             FALSE
    
    installing the source package ‘ggnewscale’
    ............
    
    install.packages("./ggcor_0.9.8.1.tar.gz",repos = NULL,type = "source")
    
    

    相关文章

      网友评论

          本文标题:Github R包终极安装方法

          本文链接:https://www.haomeiwen.com/subject/xvwyqdtx.html