# NOT RUN {
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))
if(requireNamespace("rqdatatable", quietly = TRUE)) {
library("rqdatatable")
data %.>%
ops %.>%
print(.)
}
# }
Run the code above in your browser using DataLab