【问题标题】:Installing ggplot2 from local zip isn't happening没有从本地 zip 安装 ggplot2
【发布时间】:2012-10-27 15:10:39
【问题描述】:

我使用的是 R 版本 2.15.1,但我不小心将 ggplot2 升级到了最新版本。现在我需要回滚到为 2.15.1 构建的 ggplot2 的最后一个版本。我已经从 Hadley 的 github repo 下载了 0.8.9 版本,但我似乎无法安装它。运行 install.packages() 静默失败:

> install.packages("~/My Documents/ggplot2-ggplot2-0.8.9.zip", repos=NULL)
> require(ggplot2)
Loading required package: ggplot2
Warning message:
In library(package, lib.loc = lib.loc, character.only = TRUE, logical.return = TRUE,  :
  there is no package called ‘ggplot2’

这是解决同一问题的另一种方法,使用 Hadley 的 devtools

> install_version('ggplot2',version='0.8.9', repos='http://cran.us.r-project.org',type='win.binary') 
Installing ggplot2_0.8.9.tar.gz from http://cran.us.r-project.org/src/contrib/Archive/ggplot2/ggplot2_0.8.9.tar.gz
Installing ggplot2
C:/PROGRA~1/R/R-215~1.1/bin/i386/R --vanilla CMD build "C:\Documents and Settings\matthewfrost\Local Settings\Temp\RtmpcP0EzQ\ggplot2" --no-manual --no-resave-data 

* checking for file 'C:\Documents and Settings\matthewfrost\Local Settings\Temp\RtmpcP0EzQ\ggplot2/DESCRIPTION' ... OK
* preparing 'ggplot2':
* checking DESCRIPTION meta-information ... OK
* checking for LF line-endings in source and make files
* checking for empty or unneeded directories
* looking to see if a 'data/datalist' file should be added
* building 'ggplot2_0.8.9.tar.gz'
ERROR
packaging into .tar.gz failed
Error: Command failed (1)
In addition: Warning message:
running command '"C:/PROGRA~1/R/R-215~1.1/bin/i386/R" --vanilla CMD build "C:\Documents and Settings\matthewfrost\Local Settings\Temp\RtmpcP0EzQ\ggplot2" --no-manual --no-resave-data'     had status 1 

【问题讨论】:

    标签: r ggplot2


    【解决方案1】:

    试试:

    install.packages("~/My Documents/ggplot2-ggplot2-0.8.9.zip", lib.loc="~/dev/foo/v1",repos=NULL, type= "source")
    
    library(foo, lib.loc="~/dev/foo/v1") 
    

    @Dirk Eddelbuettel

    【讨论】:

    • 感谢您添加 source 参数。它让我更进一步,因为构建不再失败,所以我会支持它。但我仍然无法将生成的文件夹作为库加载。在 library 文件夹中有一个名为 ggplot2-ggplot2-0.8.9 的目录,但 R 不会将 ggplot2ggplot2-ggplot2-0.8.9 识别为有效的安装包。
    • 您是否删除了您不想要的版本? remove.packages(pkgs, lib, version)
    • 是的,还是安装失败。
    • 谢谢,但library() 命令无法将'ggplot2''ggplot2-ggplot2-0.8.9' 识别为包,即使我指定了lib.loc 参数。
    猜你喜欢
    • 1970-01-01
    • 2015-08-30
    • 2013-03-08
    • 1970-01-01
    • 2015-07-15
    • 2019-11-08
    • 1970-01-01
    • 2014-07-03
    • 1970-01-01
    相关资源
    最近更新 更多