layout_specification: Create a record to record spec.

View source: R/opspec.R

layout_specificationR Documentation

Create a record to record spec.

Description

Create a general record to record transform specification.

Usage

layout_specification(
  incoming_shape = NULL,
  outgoing_shape = NULL,
  ...,
  recordKeys = character(0),
  incoming_controlTableKeys = colnames(incoming_shape)[[1]],
  outgoing_controlTableKeys = colnames(outgoing_shape)[[1]],
  checkNames = TRUE,
  checkKeys = TRUE,
  strict = FALSE,
  allow_rqdatatable_in = FALSE,
  allow_rqdatatable_out = FALSE
)

Arguments

incoming_shape

data.frame, definition of incoming record shape.

outgoing_shape

data.frame, defintion of outgoing record shape.

...

not used, force later arguments to bind by name.

recordKeys

vector of columns identifying records.

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.

checkNames

passed to rowrecs_to_blocks.

checkKeys

passed to rowrecs_to_blocks.

strict

passed to rowrecs_to_blocks.

allow_rqdatatable_in

logical, if TRUE allow rqdatatable shortcutting on simple conversions.

allow_rqdatatable_out

logical, if TRUE allow rqdatatable shortcutting on simple conversions.

Value

a record specification object

Examples



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)

layout <- layout_specification(
  incoming_shape = incoming_shape,
  outgoing_shape = outgoing_shape,
  recordKeys = 'record_id')

print(layout)

data %.>% layout

data %.>% layout %.>% .(t(layout))


cdata documentation built on Aug. 20, 2023, 1:06 a.m.