
data.frame
.Some discussion and examples can be found here: https://winvector.github.io/FluidData/FluidData.html.
build_pivot_control(table, columnToTakeKeysFrom, columnToTakeValuesFrom,
..., prefix = columnToTakeKeysFrom, sep = NULL,
tmp_name_source = wrapr::mk_tmp_name_source("bpc"),
temporary = FALSE)# S3 method for default
build_pivot_control(table, columnToTakeKeysFrom,
columnToTakeValuesFrom, ..., prefix = columnToTakeKeysFrom,
sep = NULL, tmp_name_source = wrapr::mk_tmp_name_source("bpcd"),
temporary = TRUE)
# S3 method for relop
build_pivot_control(table, columnToTakeKeysFrom,
columnToTakeValuesFrom, ..., prefix = columnToTakeKeysFrom,
sep = NULL, tmp_name_source = wrapr::mk_tmp_name_source("bpc"),
temporary = FALSE)
data.frame to scan for new column names (in-memory data.frame).
character name of column build new column names from.
character name of column to get values from.
not used, force later args to be by name
column name prefix (only used when sep is not NULL)
separator to build complex column names.
a tempNameGenerator from cdata::mk_tmp_name_source()
logical, if TRUE use temporary tables
control table
# NOT RUN {
d <- data.frame(measType = c("wt", "ht"),
measValue = c(150, 6),
stringsAsFactors = FALSE)
build_pivot_control(d,
'measType', 'measValue',
sep = '_')
d <- data.frame(measType = c("wt", "ht"),
measValue = c(150, 6),
stringsAsFactors = FALSE)
ops <- rquery::local_td(d) %.>%
build_pivot_control(.,
'measType', 'measValue',
sep = '_')
cat(format(ops))
if(requireNamespace("rqdatatable", quietly = TRUE)) {
library("rqdatatable")
d %.>%
ops %.>%
print(.)
}
if(requireNamespace("RSQLite", quietly = TRUE)) {
db <- DBI::dbConnect(RSQLite::SQLite(), ":memory:")
DBI::dbWriteTable(db,
'd',
d,
overwrite = TRUE,
temporary = TRUE)
db %.>%
ops %.>%
print(.)
DBI::dbDisconnect(db)
}
# }
Run the code above in your browser using DataLab