Commits


Romain Francois authored and Neal Richardson committed a1c702d3773
ARROW-8899 [R] Add R metadata like pandas metadata for round-trip fidelity ``` r library(arrow, warn.conflicts = FALSE) tab <- Table$create( a = structure(1:4, foo = "bar"), b = haven::labelled(1:4, label = "description") ) tab$metadata$r #> [1] "A\n3\n262144\n197888\n5\nUTF-8\n19\n2\n254\n531\n2\n1026\n1\n262153\n3\nfoo\n16\n1\n262153\n3\nbar\n254\n1026\n1\n262153\n5\nlabel\n16\n1\n262153\n11\ndescription\n1026\n1\n262153\n5\nclass\n16\n3\n262153\n14\nhaven_labelled\n262153\n10\nvctrs_vctr\n262153\n7\ninteger\n254\n1026\n1\n262153\n5\nnames\n16\n2\n262153\n1\na\n262153\n1\nb\n254\n" arrow:::.arrow_unserialize(tab$metadata$r) #> [[1]] #> NULL #> #> [[2]] #> [[2]]$a #> [[2]]$a$foo #> [1] "bar" #> #> #> [[2]]$b #> [[2]]$b$label #> [1] "description" #> #> [[2]]$b$class #> [1] "haven_labelled" "vctrs_vctr" "integer" df <- as.data.frame(tab) df$a #> [1] 1 2 3 4 #> attr(,"foo") #> [1] "bar" df$b #> <labelled<integer>[4]>: description #> [1] 1 2 3 4 ``` <sup>Created on 2020-06-23 by the [reprex package](https://reprex.tidyverse.org) (v0.3.0.9001)</sup> `metadata$r$` gets a serialized string of a list with 2 things: - attributes of the data frame itself - named list of attributes of each column (possibly NULL) Closes #7524 from romainfrancois/ARROW-8899/metadata Lead-authored-by: Romain Francois <romain@rstudio.com> Co-authored-by: Neal Richardson <neal.p.richardson@gmail.com> Signed-off-by: Neal Richardson <neal.p.richardson@gmail.com>