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.
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.
recordKeysvector of columns identifying records.
controlTableKeysvector of keying columns of the controlTable.
checkNamespassed to blocks_to_rowrecs.
checkKeyspassed to blocks_to_rowrecs.
strictpassed to blocks_to_rowrecs.
allow_rqdatatablelogical, if TRUE allow rqdatatable shortcutting on simple conversions.
Valuea record specification object
Examplesd <- 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)#> { #> block_record <- wrapr::qchar_frame( #> "id" , "measure", "value" | #> . , "AUC" , AUC | #> . , "R2" , R2 ) #> block_keys <- c('id', 'measure') #> #> # becomes #> #> row_record <- wrapr::qchar_frame( #> "id" , "AUC", "R2" | #> . , AUC , R2 ) #> row_keys <- c('id') #> #> # args: c(checkNames = TRUE, checkKeys = TRUE, strict = FALSE, allow_rqdatatable = FALSE) #> } #>
d %.>% transform
#> id AUC R2 #> 1 1 0.7 0.4 #> 2 2 0.8 0.5
inv_transform <- t(transform) print(inv_transform)#> { #> row_record <- wrapr::qchar_frame( #> "id" , "AUC", "R2" | #> . , AUC , R2 ) #> row_keys <- c('id') #> #> # becomes #> #> block_record <- wrapr::qchar_frame( #> "id" , "measure", "value" | #> . , "AUC" , AUC | #> . , "R2" , R2 ) #> block_keys <- c('id', 'measure') #> #> # args: c(checkNames = TRUE, checkKeys = TRUE, strict = FALSE, allow_rqdatatable = FALSE) #> } #>
# identity (in structure) d %.>% transform %.>% inv_transform
#> id measure value #> 1 1 AUC 0.7 #> 2 1 R2 0.4 #> 3 2 AUC 0.8 #> 4 2 R2 0.5
# identity again (using .() "immediate" notation) d %.>% transform %.>% .(t(transform))#> id measure value #> 1 1 AUC 0.7 #> 2 1 R2 0.4 #> 3 2 AUC 0.8 #> 4 2 R2 0.5
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4