View source: R/GeneralTransform.R
convert_records | R Documentation |
General transform from arbitrary record shape to arbitrary record shape.
convert_records(
table,
incoming_shape = NULL,
outgoing_shape = NULL,
...,
keyColumns = NULL,
columnsToCopy_in = NULL,
checkNames = TRUE,
checkKeys = FALSE,
strict = FALSE,
incoming_controlTableKeys = colnames(incoming_shape)[[1]],
outgoing_controlTableKeys = colnames(outgoing_shape)[[1]],
tmp_name_source = wrapr::mk_tmp_name_source("crec"),
temporary = TRUE,
allow_rqdatatable_in = FALSE,
allow_rqdatatable_out = FALSE
)
table |
data.frame or relop. |
incoming_shape |
data.frame, definition of incoming record shape. |
outgoing_shape |
data.frame, defintion of outgoing record shape. |
... |
force later arguments to bind by name. |
keyColumns |
character vector of column defining incoming row groups |
columnsToCopy_in |
character array of incoming column names to copy. |
checkNames |
logical, if TRUE check names. |
checkKeys |
logical, if TRUE check columnsToCopy form row keys (not a requirement, unless you want to be able to invert the operation). |
strict |
logical, if TRUE check control table name forms. |
incoming_controlTableKeys |
character, which column names of the incoming control table are considered to be keys. |
outgoing_controlTableKeys |
character, which column names of the outgoing control table are considered to be keys. |
tmp_name_source |
a tempNameGenerator from cdata::mk_tmp_name_source() |
temporary |
logical, if TRUE use temporary tables |
allow_rqdatatable_in |
logical, if TRUE allow rqdatatable shortcutting on simple conversions. |
allow_rqdatatable_out |
logical, if TRUE allow rqdatatable shortcutting on simple conversions. |
processing pipeline or transformed table
incoming_shape <- qchar_frame(
"row", "col1", "col2", "col3" |
"row1", v11, v12, v13 |
"row2", v21, v22, v23 |
"row3", v31, v32, v33 )
outgoing_shape <- qchar_frame(
"column", "row1", "row2", "row3" |
"col1", v11, v21 , v31 |
"col2", v12, v22 , v32 |
"col3", v13, v23 , v33 )
data <- build_frame(
'record_id', 'row', 'col1', 'col2', 'col3' |
1, 'row1', 1, 2, 3 |
1, 'row2', 4, 5, 6 |
1, 'row3', 7, 8, 9 |
2, 'row1', 11, 12, 13 |
2, 'row2', 14, 15, 16 |
2, 'row3', 17, 18, 19 )
print(data)
convert_records(
data,
keyColumns = 'record_id',
incoming_shape = incoming_shape,
outgoing_shape = outgoing_shape)
td <- rquery::local_td(data)
ops <- convert_records(
td,
keyColumns = 'record_id',
incoming_shape = incoming_shape,
outgoing_shape = outgoing_shape)
cat(format(ops))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.