csvy: Import and Export CSV Data with a YAML Metadata Header
> library(csvy)
バージョン: 0.1.3
関数名 | 概略 |
---|---|
csvy |
Import and Export CSV Data With a YAML Metadata Header |
read_csvy |
Import CSVY data |
write_csvy |
Export CSVY data |
read_csvy
csvyファイルの読み込み
> d <- system.file("examples", "example3.csvy", package = "csvy") %>% read_csvy()
> str(d)
'data.frame': 2 obs. of 3 variables:
$ var1: atomic A B
..- attr(*, "title")= chr "variable 1"
..- attr(*, "type")= chr "string"
..- attr(*, "description")= chr "explaining var1"
..- attr(*, "constraints")=List of 1
.. ..$ :List of 1
.. .. ..$ required: logi TRUE
$ var2: atomic 1 3
..- attr(*, "title")= chr "variable 2"
..- attr(*, "type")= chr "integer"
$ var3: atomic 2.5 4.3
..- attr(*, "title")= chr "variable 3"
..- attr(*, "type")= chr "number"
- attr(*, "name")= chr "my-dataset"
> d
var1 var2 var3
1 A 1 2.5
2 B 3 4.3
write_csvy
データフレームオブジェクトをcsvyファイルとして保存
> head(iris) %>% write_csvy()