View source: R/table-surgery.R
reunite_parent_child | R Documentation |
Perform table fusion by combining two tables by a common (key) column, and then removing this column.
reunite_parent_child()
: After joining the two tables by the column id_column
, this column will be removed.
The transformation is roughly the
inverse of what decompose_table()
does.
reunite_parent_child_from_list()
: After joining the two tables
by the column id_column
, id_column
is removed.
This function is almost exactly the inverse of decompose_table()
(the order
of the columns is not retained, and the original row names are lost).
reunite_parent_child(child_table, parent_table, id_column)
reunite_parent_child_from_list(list_of_parent_child_tables, id_column)
child_table |
Table (possibly created by |
parent_table |
Table (possibly created by |
id_column |
Identical name of referencing / referenced column in |
list_of_parent_child_tables |
Cf arguments |
A wide table produced by joining the two given tables.
These functions are marked "experimental" because they seem more useful when applied to a table in a dm object. Changing the interface later seems harmless because these functions are most likely used interactively.
Other table surgery functions:
decompose_table()
decomposed_table <- decompose_table(mtcars, new_id, am, gear, carb)
ct <- decomposed_table$child_table
pt <- decomposed_table$parent_table
reunite_parent_child(ct, pt, new_id)
reunite_parent_child_from_list(decomposed_table, new_id)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.