Add a globally unique row identifier to a dataset object.
Arguments
- ds
A dataset object.
- prefix
The prefix of the globally unique wor identifier (URI or CURIe), defaults to
"https:://example.org/my_data/"
.- keep_local_id
Defaults to
FALSE
.
Value
A dataset object with a locally unique row identifier added as a primary key to the tabular form.
See also
Other dataset functions:
dataset_local_id()
,
dataset()
Examples
my_ds <- dataset (x = data.frame (
time = rep(c(2019:2022),4),
geo = c(rep("NL",8), rep("BE",8)),
sex = c(rep("F", 4), rep("M", 4), rep("F", 4), rep("M", 4)),
value = c(1,3,2,4,2,3,1,5, NA_real_, 4,3,2,1, NA_real_, 2,5),
unit = rep("NR",8),
freq = rep("A",8)),
Dimensions = c("time", "geo", "sex"),
Measures = "value",
Attributes = c("unit", "freq"),
sdmx_attributes = c("sex", "time", "freq"),
Title = "Example dataset",
Creator = person("Jane", "Doe"),
Publisher = "Publishing Co.",
Issued = as.Date("2022-07-14")
)
dataset_uri(my_ds)
#> URI time geo sex value unit
#> 1 https:://example.org/my_data/geo=NL_sex=F_time=2019 2019 NL F 1 NR
#> 2 https:://example.org/my_data/geo=NL_sex=F_time=2020 2020 NL F 3 NR
#> 3 https:://example.org/my_data/geo=NL_sex=F_time=2021 2021 NL F 2 NR
#> 4 https:://example.org/my_data/geo=NL_sex=F_time=2022 2022 NL F 4 NR
#> 5 https:://example.org/my_data/geo=NL_sex=M_time=2019 2019 NL M 2 NR
#> 6 https:://example.org/my_data/geo=NL_sex=M_time=2020 2020 NL M 3 NR
#> 7 https:://example.org/my_data/geo=NL_sex=M_time=2021 2021 NL M 1 NR
#> 8 https:://example.org/my_data/geo=NL_sex=M_time=2022 2022 NL M 5 NR
#> 9 https:://example.org/my_data/geo=BE_sex=F_time=2019 2019 BE F NA NR
#> 10 https:://example.org/my_data/geo=BE_sex=F_time=2020 2020 BE F 4 NR
#> 11 https:://example.org/my_data/geo=BE_sex=F_time=2021 2021 BE F 3 NR
#> 12 https:://example.org/my_data/geo=BE_sex=F_time=2022 2022 BE F 2 NR
#> 13 https:://example.org/my_data/geo=BE_sex=M_time=2019 2019 BE M 1 NR
#> 14 https:://example.org/my_data/geo=BE_sex=M_time=2020 2020 BE M NA NR
#> 15 https:://example.org/my_data/geo=BE_sex=M_time=2021 2021 BE M 2 NR
#> 16 https:://example.org/my_data/geo=BE_sex=M_time=2022 2022 BE M 5 NR
#> freq
#> 1 A
#> 2 A
#> 3 A
#> 4 A
#> 5 A
#> 6 A
#> 7 A
#> 8 A
#> 9 A
#> 10 A
#> 11 A
#> 12 A
#> 13 A
#> 14 A
#> 15 A
#> 16 A