Some discussion and examples can be found here: https://winvector.github.io/FluidData/FluidData.html.
build_pivot_control_q( tableName, columnToTakeKeysFrom, columnToTakeValuesFrom, my_db, ..., prefix = columnToTakeKeysFrom, sep = NULL, qualifiers = NULL )Arguments tableName
Name of table to scan for new column names.
columnToTakeKeysFromcharacter name of column build new column names from.
columnToTakeValuesFromcharacter name of column to get values from.
my_dbdb handle
...not used, force later args to be by name
prefixcolumn name prefix (only used when sep is not NULL)
sepseparator to build complex column names.
qualifiersoptional named ordered vector of strings carrying additional db hierarchy terms, such as schema.
Valuecontrol table
See alsoblocks_to_rowrecs_q
, build_pivot_control
if (requireNamespace("DBI", quietly
= TRUE) && requireNamespace("RSQLite", quietly
= TRUE)) { my_db <- DBI::dbConnect(RSQLite::SQLite(),
":memory:") d <- data.frame(measType
= c("wt",
"ht"), measValue
= c(150,
6), stringsAsFactors
= FALSE) rquery::rq_copy_to(my_db,
'd',
d, overwrite
= TRUE, temporary
= TRUE) build_pivot_control_q('d',
'measType',
'measValue', my_db
= my_db, sep
= '_') %.>% print(.) DBI::dbDisconnect(my_db) }#> measType measValue #> 1 ht measType_ht #> 2 wt measType_wt
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