本文介绍了如何添加“可选数据集描述"?羽毛文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
feather_metadata
的R帮助说明返回维,字段名称和类型;以及可选的数据集描述".但是没有有关如何添加数据描述的信息.我希望可以将其添加为属性,但这似乎不起作用.
The R-help for feather_metadata
states "Returns the dimensions, field names, and types; and optional dataset description." but there is no information on how to add the data description. I hoped it could be added as an attribute but that doesn't seem to work.
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"
推荐答案
我刚刚为此功能提交了PR.如果您愿意从源代码安装,则可以从 https://github.com/hrbrmstr/feather和:
I just submitted a PR for this functionality. If you are willing to install from source, you can install from https://github.com/hrbrmstr/feather and:
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"
这篇关于如何添加“可选数据集描述"?羽毛文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!