blocks_to_rowrecs_spec: Create a block records to row records transform...

View source: R/opspec.R

blocks_to_rowrecs_specR Documentation

Create a block records to row records transform specification.

Description

Create a block records to row records transform specification object that holds the pivot control table, specification of extra row keys, and control table keys.

Usage

blocks_to_rowrecs_spec(
  controlTable,
  ...,
  recordKeys = character(0),
  controlTableKeys = colnames(controlTable)[[1]],
  checkNames = TRUE,
  checkKeys = TRUE,
  strict = FALSE,
  allow_rqdatatable = FALSE
)

Arguments

controlTable

an all character data frame or cdata pivot control.

...

not used, force later arguments to bind by name.

recordKeys

vector of columns identifying records.

controlTableKeys

vector of keying columns of the controlTable.

checkNames

passed to blocks_to_rowrecs.

checkKeys

passed to blocks_to_rowrecs.

strict

passed to blocks_to_rowrecs.

allow_rqdatatable

logical, if TRUE allow rqdatatable shortcutting on simple conversions.

Value

a record specification object

Examples


d <- wrapr::build_frame(
  "id", "measure", "value" |
  1   , "AUC"    , 0.7     |
  1   , "R2"     , 0.4     |
  2   , "AUC"    , 0.8     |
  2   , "R2"     , 0.5     )

transform <- blocks_to_rowrecs_spec(
  wrapr::qchar_frame(
    "measure", "value" |
    "AUC"    , AUC     |
    "R2"     , R2      ),
  recordKeys = "id")

print(transform)

d %.>% transform

inv_transform <- t(transform)
print(inv_transform)

# identity (in structure)
d %.>% transform %.>% inv_transform

# identity again (using .() "immediate" notation)
d %.>% transform %.>% .(t(transform))



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