View source: R/shared_class_functions.r
merge_schemas | R Documentation |
Generic function that merges pairs of an object's schemas with matching sets of keys. The remaining schemas contain all the attributes from the schemas merged into them.
merge_schemas(x, to_remove, merge_into, ...)
x |
a relational schema object, such as a |
to_remove |
an integer vector, giving the indices for schemas to be merged into other schemas, then removed. |
merge_into |
an integer vector of the same length as |
... |
further arguments passed on to methods. |
An R object of the same class as x
, where the relations have
been merged as indicated.
merge_empty_keys
, which is based on this function.
rs <- relation_schema(
list(
a = list(c("a", "b"), list("a")),
b = list(c("b", "c"), list("b")),
b.1 = list(c("b", "d"), list("b")),
d = list(c("d", "e"), list("d", "e"))
),
letters[1:5]
)
ds <- database_schema(
rs,
list(
list("a", "b", "b", "b"),
list("b.1", "d", "d", "d")
)
)
merge_schemas(rs, 3, 2) # merging b and b.1
merge_schemas(ds, 3, 2) # also merging their references
# merging a schema into itself just removes it
merge_schemas(rs, 3, 3)
merge_schemas(ds, 3, 3)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.