解压缩的默认.Options设置

时间:2013-12-05 18:53:49

标签: r configuration unzip

我正在尝试安装ramnathv's slidify package,并对以下错误感到惊讶:

# install.packages("devtools")
library(devtools)
install_github("slidify","ramnathv")
Installing github repo slidify/master from ramnathv
Downloading slidify.zip from https://github.com/ramnathv/slidify/archive/master.zip
Installing package from /tmp/RtmpOFEJuD/slidify.zip
Error in unzip(src, exdir = target, unzip = getOption("unzip")) : 
  'unzip' must be a single character string

我以前安装过它,在使用相同的Arch Linux设置和R套件的其他系统上没有任何问题,因为它是R(3.0.0或3.0.1)的早期版本。

在Google上搜索错误时,它来自zip.R

中的这一位
unzip <-
    function(zipfile, files = NULL, list = FALSE, overwrite = TRUE,
             junkpaths = FALSE, exdir = ".", unzip = "internal",
             setTimes = FALSE)
{
    if(identical(unzip, "internal")) {
        if(!list && !missing(exdir))
            dir.create(exdir, showWarnings = FALSE, recursive = TRUE)
        res <- .External(C_unzip, zipfile, files, exdir, list, overwrite,
                         junkpaths, setTimes)
        if(list) {
            dates <- as.POSIXct(res[[3]], "%Y-%m-%d %H:%M",  tz="UTC")
            data.frame(Name = res[[1]], Length = res[[2]], Date = dates,
                       stringsAsFactors = FALSE)
        } else invisible(attr(res, "extracted"))
    } else {
        WINDOWS <- .Platform$OS.type == "windows"
        if(!is.character(unzip) || length(unzip) != 1L || !nzchar(unzip))
            stop("'unzip' must be a single character string")

...

虽然default setting for unzip()unzip = "internal",但也可以传递getOptions("unzip")

Usage

unzip(zipfile, files = NULL, list = FALSE, overwrite = TRUE,
      junkpaths = FALSE, exdir = ".", unzip = "internal",
      setTimes = FALSE)

...

unzip
The method to be used. An alternative is to use getOption("unzip"),
which on a Unix-alike may be set to the path to a unzip program.

在查看.Options的输出时,我确实看到没有为unzip设置任何内容:

> .Options$unzip
[1] ""

从详细的文档中,我看到我可以在~/.Renviron中设置它,但我的问题是在Linux系统上是否应该默认选择它,或者是否必须设置{{1命令?

如果它是标准,这是未填充的,我将向Arch Linux提交一份错误报告,因为可能没有将此软件包编译为默认情况,documentation seems to suggest如果在安装过程中找到一个解压缩命令,它将填充解压缩命令:

unzip

我正在使用的Arch包是一个二进制文件,因此是预编译的,所以有意或无意地可能忽略了或者在安装过程中应该检查它?


P.S。只是为了避免明显......

unzip
a character string, the path of the command used for unzipping help files, or
"internal". Defaults to the value of R_UNZIPCMD, which is set in ‘etc/Renviron’
if an unzip command was found during configuration.

0 个答案:

没有答案