0

用于状态的 R 帮助feather_metadata“返回维度、字段名称和类型;以及可选的数据集描述。” 但没有关于如何添加数据描述的信息。我希望它可以作为属性添加,但这似乎不起作用。

library(feather)

dat <- data.frame(a = 1:3, b = 4:6)
attr(dat, "description") <- "A data.frame"
write_feather(dat,  "df.feather")
str(feather_metadata("df.feather"))

str返回:

List of 5
 $ path       : chr "df.feather"
 $ dim        : int [1:2] 3 2
 $ types      : Named chr [1:2] "integer" "integer"
  ..- attr(*, "names")= chr [1:2] "a" "b"
 $ description: chr ""
 $ version    : int 2
 - attr(*, "class")= chr "feather_metadata"
4

1 回答 1

1

我刚刚为此功能提交了 PR。如果您愿意从源代码安装,可以从https://github.com/hrbrmstr/feather安装,并且:

library(feather)

dat <- data.frame(a = 1:3, b = 4:6)

write_feather(dat,  "df.feather", "I am the very model of a modern major general")

str(feather_metadata("df.feather"))
##List of 5
## $ path       : chr "df.feather"
## $ dim        : int [1:2] 3 2
## $ types      : Named chr [1:2] "integer" "integer"
##  ..- attr(*, "names")= chr [1:2] "a" "b"
## $ description: chr "I am the very model of a modern major general"
## $ version    : int 2
##  - attr(*, "class")= chr "feather_metadata"
于 2017-12-20T02:59:29.933 回答