Skip to contents

Read or update the Data Structure Definition of a dataset.

Usage

DataStructure(x)

DataStructure_update(x, value)

Arguments

x

A dataset.

value

A DataStructure definition.

Value

A dataset object, which is a data.frame or inherited object with rich metadata.

Examples

DataStructure(iris_dataset)
#> $Sepal.Length
#> $Sepal.Length$name
#> [1] "Sepal.Length"
#> 
#> $Sepal.Length$label
#> [1] "The sepal length of iris specimen in centimeters."
#> 
#> $Sepal.Length$type
#> [1] ""
#> 
#> $Sepal.Length$range
#> [1] "xsd:decimal"
#> 
#> $Sepal.Length$comment
#> [1] ""
#> 
#> $Sepal.Length$concept
#> $Sepal.Length$concept$heading
#> [1] ""
#> 
#> $Sepal.Length$concept$schemeURI
#> [1] ""
#> 
#> $Sepal.Length$concept$valueURI
#> [1] ""
#> 
#> 
#> $Sepal.Length$defintion
#> $Sepal.Length$defintion$schemeURI
#> [1] ""
#> 
#> $Sepal.Length$defintion$valueURI
#> [1] ""
#> 
#> 
#> 
#> $Sepal.Width
#> $Sepal.Width$name
#> [1] "Sepal.Width"
#> 
#> $Sepal.Width$label
#> [1] "The sepal width of iris specimen in centimeters."
#> 
#> $Sepal.Width$type
#> [1] ""
#> 
#> $Sepal.Width$range
#> [1] "xsd:decimal"
#> 
#> $Sepal.Width$comment
#> [1] ""
#> 
#> $Sepal.Width$concept
#> $Sepal.Width$concept$heading
#> [1] ""
#> 
#> $Sepal.Width$concept$schemeURI
#> [1] ""
#> 
#> $Sepal.Width$concept$valueURI
#> [1] ""
#> 
#> 
#> $Sepal.Width$defintion
#> $Sepal.Width$defintion$schemeURI
#> [1] ""
#> 
#> $Sepal.Width$defintion$valueURI
#> [1] ""
#> 
#> 
#> 
#> $Petal.Length
#> $Petal.Length$name
#> [1] "Petal.Length"
#> 
#> $Petal.Length$label
#> [1] "The petal length of iris specimen in centimeters."
#> 
#> $Petal.Length$type
#> [1] ""
#> 
#> $Petal.Length$range
#> [1] "xsd:decimal"
#> 
#> $Petal.Length$comment
#> [1] ""
#> 
#> $Petal.Length$concept
#> $Petal.Length$concept$heading
#> [1] ""
#> 
#> $Petal.Length$concept$schemeURI
#> [1] ""
#> 
#> $Petal.Length$concept$valueURI
#> [1] ""
#> 
#> 
#> $Petal.Length$defintion
#> $Petal.Length$defintion$schemeURI
#> [1] ""
#> 
#> $Petal.Length$defintion$valueURI
#> [1] ""
#> 
#> 
#> 
#> $Petal.Width
#> $Petal.Width$name
#> [1] "Petal.Width"
#> 
#> $Petal.Width$label
#> [1] "The petal width of iris specimen in centimeters."
#> 
#> $Petal.Width$type
#> [1] ""
#> 
#> $Petal.Width$range
#> [1] "xsd:decimal"
#> 
#> $Petal.Width$comment
#> [1] ""
#> 
#> $Petal.Width$concept
#> $Petal.Width$concept$heading
#> [1] ""
#> 
#> $Petal.Width$concept$schemeURI
#> [1] ""
#> 
#> $Petal.Width$concept$valueURI
#> [1] ""
#> 
#> 
#> $Petal.Width$defintion
#> $Petal.Width$defintion$schemeURI
#> [1] ""
#> 
#> $Petal.Width$defintion$valueURI
#> [1] ""
#> 
#> 
#> 
#> $Species
#> $Species$name
#> [1] "Species"
#> 
#> $Species$label
#> [1] "The iris species of the observed plant."
#> 
#> $Species$type
#> [1] ""
#> 
#> $Species$range
#> [1] "coded"
#> 
#> $Species$comment
#> [1] ""
#> 
#> $Species$concept
#> $Species$concept$heading
#> [1] ""
#> 
#> $Species$concept$schemeURI
#> [1] ""
#> 
#> $Species$concept$valueURI
#> [1] ""
#> 
#> 
#> $Species$defintion
#> $Species$defintion$schemeURI
#> [1] ""
#> 
#> $Species$defintion$valueURI
#> [1] ""
#> 
#> 
#> 
dsd_iris <- DataStructure(iris_dataset)
dsd_iris$Sepal.Length$label <- "The sepal length measured in centimeters."
dsd_iris$Sepal.Width$label  <- "The sepal width measured in centimeters."
dsd_iris$Petal.Length$label <- "The petal length measured in centimeters."
dsd_iris$Petal.Width$label  <- "The petal width measured in centimeters."
dsd_iris$Species$label      <- "The name of the Iris species in the observation."

iris_dataset_labelled <- DataStructure_update(iris_dataset, dsd_iris)

vapply(DataStructure(iris_dataset_labelled), function(x) x$label, character(1))
#>                                       Sepal.Length 
#>        "The sepal length measured in centimeters." 
#>                                        Sepal.Width 
#>         "The sepal width measured in centimeters." 
#>                                       Petal.Length 
#>        "The petal length measured in centimeters." 
#>                                        Petal.Width 
#>         "The petal width measured in centimeters." 
#>                                            Species 
#> "The name of the Iris species in the observation."