我在试图加快read.table步骤的Windows机器上。我的文件都是.gz。如何使用fread读取R中的gz文件?
x=paste("gzip -c ",filename,sep="")
phi_raw = fread(x)
Error in fread(x) :
无法理解错误。它对我来说有点太神秘了。
不像zx8754建议的那样重复:专门用于fread的上下文中。虽然fread dows没有原生的gzip支持,但这种模式应该可行。见http://www.molpopgen.org/coding/datatable.html
更新
每建议使用以下系统产生一个较长的错误消息 - 尽管我仍然坚持。
Error in fread(system(x)) :
'input' must be a single character string containing a file name, a command, full path to a file, a URL starting 'http[s]://', 'ftp[s]://' or 'file://', or the input data itself
In addition: Warning message:
running command 'gzip -c D:/x_.gz' had status 1
更新
与gunzip解运行如下指出:
Error in fread(system(x)) :
'input' must be a single character string containing a file name, a command, full path to a file, a URL starting 'http[s]://', 'ftp[s]://' or 'file://', or the input data itself
In addition: Warning message:
running command 'gunzip -c D:/XX_.gz' had status 127
注意不同的状态
https://github.com/Rdatatable/data.table/issues/717 – zx8754
[Decompress gz file using R]可能重复(http://stackoverflow.com/questions/5764499/decompress-gz-file-使用-r) – zx8754
不是重复的:在fread中特别使用。虽然fread dows没有原生的gzip支持,但这种模式应该可行。 – pythOnometrist