R:通过 rbindlist + cmd 读取许多压缩文件
R: fread many zipped files via rbindlist + cmd
我正在尝试通过 rbindlist 将多个压缩文件读入一个数据 table。在 data.table() 的旧版本中,这有效,并且仍然有效,但是现在它在每个文件上给出以下警告。
data.table::rbindlist(lapply(paste0("unzip -p ",filelist), data.table::fread,fill=T),idcol=T)
Taking input= as a system command ('unzip -p ****') and a variable has been used in the expression passed to input=
. Please use fread(cmd=...). There is a security concern if you are creating an app, and the app could have a malicious user, and the app is not running in a secure environment; e.g. the app is running as root. Please read item 5 in the NEWS file for v1.11.6 for more information and for the option to suppress this message.
我了解其中的风险并希望抑制这些消息。我看到有两种方法可以做到这一点:1)打开一个标志来抑制——但我在手册中找不到一个选项; 2) 将文件名明确指定给 fread cmd= 。但是我不确定如何有效地循环遍历此处的列表。
抱歉,该示例不可重现,但思路应该很清楚 - 有什么建议吗?谢谢!
调用它的正确方法是使用:
data.table::rbindlist(lapply(paste0("unzip -p ", filelist),
function(x) data.table::fread(cmd = x, fill=TRUE)),
idcol=TRUE)
我正在尝试通过 rbindlist 将多个压缩文件读入一个数据 table。在 data.table() 的旧版本中,这有效,并且仍然有效,但是现在它在每个文件上给出以下警告。
data.table::rbindlist(lapply(paste0("unzip -p ",filelist), data.table::fread,fill=T),idcol=T)
Taking input= as a system command ('unzip -p ****') and a variable has been used in the expression passed to
input=
. Please use fread(cmd=...). There is a security concern if you are creating an app, and the app could have a malicious user, and the app is not running in a secure environment; e.g. the app is running as root. Please read item 5 in the NEWS file for v1.11.6 for more information and for the option to suppress this message.
我了解其中的风险并希望抑制这些消息。我看到有两种方法可以做到这一点:1)打开一个标志来抑制——但我在手册中找不到一个选项; 2) 将文件名明确指定给 fread cmd= 。但是我不确定如何有效地循环遍历此处的列表。
抱歉,该示例不可重现,但思路应该很清楚 - 有什么建议吗?谢谢!
调用它的正确方法是使用:
data.table::rbindlist(lapply(paste0("unzip -p ", filelist),
function(x) data.table::fread(cmd = x, fill=TRUE)),
idcol=TRUE)