问题描述
我开始从 R 中的“feather”包中得到一个非常奇怪的错误:
假设我读写文件
intervalCurrentTime
最后一个给我
write_feather(mtcars,'m')
read_feather('m')
我重新安装了软件包,重新启动会话,但仍然不知道如何修复它。 R 版本 3.6.1 (2019-07-05)
请帮帮我
解决方法
这是我最后找到的解决方案:
devtools::install_github("tidyverse/tibble",force = TRUE)
问题在于“read_feather”函数的更新代码。 它现在使用“as_tibble”函数。通过更新“tibble”包,这开始工作正常。
这是新版本中'read_feather'的代码:
tibble:3.1.0 - 羽毛:0.3.5 - read_feather
function (path,columns = NULL)
{
data <- feather(path)
on.exit(close(data),add = TRUE)
if (is.null(columns))
as_tibble(data)
else as_tibble(data[columns])
}
这里是之前版本中'read_feather'的代码:
tibble:3.0.1 - 羽毛:0.3.5 - read_feather
function (file,col_select = NULL,as_data_frame = TRUE,...)
{
reader <- FeatherTableReader$create(file,...)
all_columns <- ipc___feather___TableReader__column_names(reader)
col_select <- enquo(col_select)
columns <- if (!quo_is_null(col_select)) {
vars_select(all_columns,!!col_select)
}
out <- reader$Read(columns)
if (isTRUE(as_data_frame)) {
out <- as.data.frame(out)
}
out
}