Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/r/80.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
是否可以在R中保存和读取压缩zip格式的feather文件?_R_Zip_Feather - Fatal编程技术网

是否可以在R中保存和读取压缩zip格式的feather文件?

是否可以在R中保存和读取压缩zip格式的feather文件?,r,zip,feather,R,Zip,Feather,我需要以更紧凑的格式保存feather数据。经过几次测试,我发现使用“zip”函数后,“feather”数据文件的大小减少了90% library(feather) library(zip) # Write data in feather format write_feather(df, "data.feather) # Write data in zip feather format zip("data.feather.zip", "data.feather") # How to hav

我需要以更紧凑的格式保存feather数据。经过几次测试,我发现使用“zip”函数后,“feather”数据文件的大小减少了90%

library(feather)
library(zip)

# Write data in feather format
write_feather(df, "data.feather)

# Write data in zip feather format
zip("data.feather.zip", "data.feather")

# How to have commands like these ones without using disk space for temp file?
write_feather(df, "data.feather.zip", format = "zip")
df <- read_feather("data.feather.zip", format = "zip")
库(feather)
图书馆(邮政编码)
#以羽毛格式写入数据
写_feather(df,“data.feather”)
#以zip格式写入数据
zip(“data.feather.zip”、“data.feather”)
#如何在不使用临时文件的磁盘空间的情况下使用这些命令?
写羽毛(df,“data.feather.zip”,format=“zip”)

df查看库
箭头
。您可以通过压缩保存为.parquet。性能与feather类似,但文件要小得多。如果不需要feather,您可以使用
fst
读取和写入压缩数据帧。例如,使用80%压缩写入
fst::write_fst(df,'mydat.fst',compress=80)
这也可能会有帮助,尽管没有直接回答您的问题,我知道。@IceCreamToucan感谢您的建议。我选中了“fst”。看起来很酷。唯一的问题是——是否可以用Python读取“fst”文件?因为羽毛格式是可以的。谢谢!不,不可能(至少使用预制工具)此时请查看库
arrow
。您可以通过压缩保存为.parquet。与feather的性能类似,但文件要小得多。如果不需要feather,您可以使用
fst
读取和写入压缩数据帧。例如,使用80%压缩写入
fst::write\u fst(df,'mydat.fst',compress=80)
这可能也会有帮助,虽然我知道没有直接回答您的问题。@IceCreamToucan感谢您的建议。我选中了“fst”。看起来很酷。唯一的问题是,是否可以用Python读取“fst”文件?因为它可能是feather格式。谢谢!不,不可能(至少使用预制工具)此时