0

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 returns:

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"
Vincent
  • 5,063
  • 3
  • 28
  • 39

1 Answers1

1

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"
hrbrmstr
  • 77,368
  • 11
  • 139
  • 205
  • Thanks @hrbrmstr! I downloaded the .tgz and .tar.gz files. The .tgz doesn't seem to have the `description` argument and compilation failed for the .tar.gz! There were no changes in feather/R so installing using `devtools` wasn't an option. The fork at `hrbrmstr/feather` doesn't have an option to submit issues so I sent details in a PM – Vincent Dec 20 '17 at 21:16
  • You can `devtools::install_github("hrbrmstr/feather", subdir="R")` – hrbrmstr Dec 20 '17 at 22:14
  • I did try that. I'm still getting `unused argument ("I am the very model of a modern major general")` however. I assume because there haven't been any changes in the `hrbrmstr/feather/R` directory – Vincent Dec 20 '17 at 22:58
  • Hrm. But there are. I shall poke after dinner. – hrbrmstr Dec 20 '17 at 23:40
  • Huh. This is what I get for doing stuff in the wee hours of the day. I have verified — https://github.com/hrbrmstr/feather/blob/master/R/R/feather.R#L30 — that the new functionality is in there now so pls try it again. – hrbrmstr Dec 21 '17 at 00:30