我正在尝试使用R从API下载的LZMA存档中提取文件,其中包含JSON文件,并对其进行翻译。在我的计算机上,我可以在Windows Explorer中手动提取文件而没有任何问题。
以下是我目前的代码(已删除API详细信息):
当我尝试解压文件时,出现以下错误信息:
以下是我目前的代码(已删除API详细信息):
tempFile <- tempfile()
destDir <- "extracted-files"
if (!dir.exists(destDir)) dir.create(destDir)
download.file("api_url.tar.xz", destfile = tempFile)
untar(tempFile, exdir = destDir)
当我尝试解压文件时,出现以下错误信息:
/usr/bin/tar: This does not look like a tar archive
/usr/bin/tar: Skipping to next header
/usr/bin/tar: Exiting with failure status due to previous errors
Warning messages:
1: running command 'tar.exe -xf "C:\Users\XXX\AppData\Local\Temp\RtmpMncPWp\file2eec75e23a15" -C "extracted-files"' had status 2
2: In untar(tempFile, exdir = destDir) :
‘tar.exe -xf "C:\Users\XXX\AppData\Local\Temp\RtmpMncPWp\file2eec75e23a15" -C "extracted-files"’ returned error code 2
我正在使用安装了 R 版本 3.3.1 (2016-06-21) 的 Windows 10 操作系统。