Learn R Programming

replyr (version 0.8.2)

buildPivotControlTable: Build a moveValuesToColumnsQ() control table that specifies a pivot.

Description

Some discussion and examples can be found here: https://winvector.github.io/replyr/articles/FluidData.html.

Usage

buildPivotControlTable(d, columnToTakeKeysFrom, columnToTakeValuesFrom, ...,
  prefix = columnToTakeKeysFrom, sep = NULL)

Arguments

d

data to scan for new column names

columnToTakeKeysFrom

character name of column build new column names from.

columnToTakeValuesFrom

character name of column to get values from.

...

not used, force later args to be by name

prefix

column name prefix (only used when sep is not NULL)

sep

separator to build complex column names.

Value

control table

See Also

https://github.com/WinVector/cdata, moveValuesToRows, moveValuesToColumns, moveValuesToRowsQ, moveValuesToColumnsQ

Examples

Run this code
# NOT RUN {
d <- data.frame(measType = c("wt", "ht"),
                measValue = c(150, 6),
                stringsAsFactors = FALSE)
buildPivotControlTable(d, 'measType', 'measValue', sep='_')

# }

Run the code above in your browser using DataLab