我一直在尝试解压多个大文件。我一直在尝试使用 Adam Bethke 提供的这个功能(见here)及以下内容:
decompress_file <- function(directory, file, .file_cache = FALSE) {
if (.file_cache == TRUE) {
print("decompression skipped")
} else {
# Set working directory for decompression
# simplifies unzip directory location behavior
wd <- getwd()
setwd(directory)
# Run decompression
decompression <-
system2("unzip",
args = c("-o", # include override flag
file),
stdout = TRUE)
# uncomment to delete archive once decompressed
# file.remove(file)
# Reset working directory
setwd(wd); rm(wd)
# Test for success criteria
# change the search depending on
# your implementation
if (grepl("Warning message", tail(decompression, 1))) {
print(decompression)
}
}
}
但是,我不断收到错误消息:
Error in system2("unzip", args = c("-o", file), stdout = TRUE) :
'"unzip"' not found
任何帮助/指导将不胜感激。
system2
正在访问您的系统终端。
您链接的答案指出它是为 UNIX 计算机(如 Mac 和 Linux)设计的。它不是为 Windows 机器设计的,但现在您可以轻松地在 Windows 上安装 Ubuntu(在单独的分区上)。
请确保您的机器上也安装了unzip
;在您的终端中,只需运行unzip
.