Qu

insert_row

Builtin index · Collections & strings

result = insert_row(t, i, record)

Input: t, i, record · Output: result

What it is

Inserts one row into a table at a chosen position. t is a Table; i is a number (0-based row position, i equal to the row count appends); record is a Record supplying one value per existing column, matched by field name.

Overloads

One call shape — this function is not overloaded.

CodeInputOutputDescription
result = insert_row(t, i, record)
t Tablet is a Table.
i numberi is a number (0-based row position, i equal to the row count appends).
record Recordrecord is a Record supplying one value per existing column, matched by field name.
result Table
Returns a NEW Table.

Examples

From the documentation, and run by the build -- the output and the figure below are what the engine actually produced. Simplest first.

df = DataFrame(id=[1, 2, 3], name=["alu", "steel", "brass"])
print(at(df, 1))                              # {id = 2, name = "steel"}

labeled = index(df, "name")
print(labeled)
grown = insert_row(df, 3, {id=4, name="glass"})
print(grown)
output
{id = 2, name = "steel"}
id  name 
--  -----
 1  alu  
 2  steel
 3  brass
id  name 
--  -----
 1  alu  
 2  steel
 3  brass
 4  glass

from collections-strings

How it works

insert_row(t, i, record) (§ table row index, 2026-08-26) — a new Table with a new row inserted at position i (i == nrow(t) appends). record supplies one value per existing column, matched by field name (a {a=1,b=2} literal, the same read-only record type .at(i)/t[key] read rows back out as).

From the note above this builtin in the interpreter, where the reasoning was written down as it was built.