newTable
The newTable
method creates an in-memory table from a list of columns. Each column must have an equal number of elements.
Syntax
newTable(size, names, columnSources)
newTable(size, columns)
newTable(definition)
newTable(columnHolders...)
newTable(definition, columnHolders...)
Parameters
Parameter | Type | Description |
---|---|---|
columnHolders | ColumnHolder... | A list of columnHolders from which to create the new table. Columns are created using the following methods: |
names | String... | A list of column names. |
size | long | The number of rows to allocate. |
columns | Map | A Map of column names and ColumnSources. |
definition | TableDefinition | The TableDefinition (column names and properties) to use for the new table. |
Returns
An in-memory table.
Examples
The following example creates a table with one column of three integer values.
result = newTable(
intCol("IntegerColumn", 1, 2, 3)
)
- result
The following example creates a table with a double and a string column.
result = newTable(
doubleCol("Doubles", 3.1, 5.45, -1.0),
stringCol("Strings", "Creating", "New", "Tables")
)
- result