renameColumns
The renameColumns
method creates a new table with specified columns renamed.
Syntax
table.renameColumns(pairs...)
table.renameColumns(columns...)
Parameters
Parameter | Type | Description |
---|---|---|
columns | String... | Columns that will be renamed in the new table.
|
columns | Collection<String> | Columns that will be renamed in the new table.
|
pairs | MatchPair... | Columns that will be renamed in the new table.
|
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")
- source
- result