Skip to contents

Dimensions of a dataset

Usage

dimensions(x)

dimensions(x, sdmx_attributes = NULL) <- value

Arguments

x

A data.frame or inherited tibble, data.frame, or a structured list.

sdmx_attributes

The optional dimensions and attributes that conform with SDMX. c("time", "geo") will mark the "time" and "geo" attributes as conforming to sdmx. See sdmx-attribute.

value

The name or column number of the within the dataset.

Value

A data frame of the names, class, isDefinedBy, and codeList properties of the dimensions columns of the dataset following the datacube model.

Details

Do not confuse with base::dim. The dimension in the definition of the DataSet is different from the 'dimension' definition of the R language.

Examples

df <- data.frame ( sex = c("M", "F"), value = c(1,2), unit = c("NR", "NR"))
dimensions(df, sdmx_attributes = "sex") <- "sex"
measures(df) <- "value"
attributes_measures(df) <- "unit"
dimensions(df)
#>     names     class
#> sex   sex character
#>                                                                                                                                                isDefinedBy
#> sex https://purl.org/linked-data/cube|https://raw.githubusercontent.com/UKGovLD/publishing-statistical-data/master/specs/src/main/vocab/sdmx-attribute.ttl
#>            codeList
#> sex not yet defined