Skip to main content
Version: Java (Groovy)

renameColumns

The renameColumns method creates a new table with specified columns renamed.

Syntax

table.renameColumns(pairs...)
table.renameColumns(columns...)

Parameters

ParameterTypeDescription
columnsString...

Columns that will be renamed in the new table.

  • "X = Y" will rename source column Y to X.
columnsCollection<String>

Columns that will be renamed in the new table.

  • "X = Y" will rename source column Y to X.
pairsMatchPair...

Columns that will be renamed in the new table.

  • "X = Y" will rename source column Y to X.

Returns

A new table that renames the specified columns.

Examples

The following example renames columns A and C:

source = newTable(
stringCol("A", "apple", "apple", "orange", "orange", "plum", "plum"),
intCol("B", 1, 1, 2, 2, 3, 3),
stringCol("C", "Macoun", "Opal", "Navel", "Cara Cara ", "Greengage", "Mirabelle"),
intCol("D", 1, 2, 12, 3, 2, 3),
)

result = source.renameColumns("Fruit = A", "Type = C")