View source: R/bind_defined_rows.R
bind_defined_rows | R Documentation |
Add rows of dataset y
to dataset x
, validating all
semantic metadata. Metadata (labels, units, concept definitions,
namespaces) must match exactly. Additional dataset-level metadata such as
title and creator can be overridden using ...
.
bind_defined_rows(x, y, ..., strict = FALSE)
x |
A |
y |
A |
... |
Optional dataset-level attributes such as |
strict |
Logical. If |
This function combines two semantically enriched datasets created
with dataset_df()
. All variable-level attributes — including labels,
units, concept definitions, and namespaces — must match. If strict =
TRUE
(the default), the row identifier namespace (used in the rowid
column) must also match exactly.
If strict = FALSE
, row identifiers from y
may differ and will
be ignored; the output will inherit x
's row identifier scheme.
A new dataset_df
object with rows from x
and y
, combined
semantically.
A <- dataset_df(
length = defined(c(10, 15),
label = "Length",
unit = "cm", namespace = "http://example.org"
),
identifier = c(id = "http://example.org/dataset#"),
dataset_bibentry = dublincore(
title = "Dataset A",
creator = person("Alice", "Smith")
)
)
B <- dataset_df(
length = defined(c(20, 25),
label = "Length",
unit = "cm", namespace = "http://example.org"
),
identifier = c(id = "http://example.org/dataset#")
)
bind_defined_rows(A, B) # succeeds
C <- dataset_df(
length = defined(c(30, 35),
label = "Length",
unit = "cm", namespace = "http://example.org"
),
identifier = c(id = "http://another.org/dataset#")
)
## Not run:
bind_defined_rows(A, C, strict = TRUE) # fails: mismatched rowid
## End(Not run)
bind_defined_rows(A, C, strict = FALSE) # succeeds: rowid inherited
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.