I agree with @ Sixiang.Hu's answer, R unzip () will not work reliably with files larger than 4 GB.
To get how you decided it? : I tried several different tricks with it, and in my experience the result of something using the built-in R-cards is (almost) the consistently incorrect identification of the end-of-file marker (EOF) before the actual end of the file.
, , , , UNIX unzip. , (unzip()), .
decompress_file <- function(directory, file, .file_cache = FALSE) {
if (.file_cache == TRUE) {
print("decompression skipped")
} else {
wd <- getwd()
setwd(directory)
decompression <-
system2("unzip",
args = c("-o",
file),
stdout = TRUE)
setwd(wd); rm(wd)
if (grepl("Warning message", tail(decompression, 1))) {
print(decompression)
}
}
}
:
, :
system2 , : "system2 - , "directory file directory; , unzip ( )- , -o ,
.file_cache,- , , , inline
- system2 stdout ,
- a
if + grepl check stdout stdout,