@robinpath/table
0.1.1Node.jsPublicTabular data operations: filter, sort, join, group, aggregate, pivot � like a lightweight DataFrame
Table
Tabular data operations: filter, sort, join, group, aggregate, pivot — like a lightweight DataFrame
Package: @robinpath/table | Category: Analytics | Type: Integration
Authentication
No authentication required. All functions are available immediately.
Use Cases
Use the table module when you need to:
- Create a table from array of objects or columns+rows -- Use
table.createto perform this operation - Select specific columns -- Use
table.selectto perform this operation - Filter rows by condition -- Use
table.whereto perform this operation - Sort rows by a field -- Use
table.orderByto perform this operation - Group rows by a field -- Use
table.groupByto perform this operation
Quick Reference
| Function | Description | Returns |
|---|---|---|
create | Create a table from array of objects or columns+rows | Array of row objects |
select | Select specific columns | Table with selected columns |
where | Filter rows by condition | Filtered rows |
orderBy | Sort rows by a field | Sorted table |
groupBy | Group rows by a field | Grouped rows keyed by field value |
aggregate | Aggregate grouped data | Aggregated results |
join | Join two tables | Joined table |
distinct | Remove duplicate rows | Deduplicated table |
limit | Take first N rows | First N rows |
offset | Skip first N rows | Remaining rows |
addColumn | Add a column with a default value | Table with new column |
removeColumn | Remove column(s) | Table without specified columns |
renameColumn | Rename a column | Table with renamed column |
pivot | Pivot table | Pivoted table |
unpivot | Unpivot/melt table | Unpivoted table with key/value columns |
count | Count rows | Row count |
sum | Sum a numeric column | Sum |
avg | Average a numeric column | Average |
min | Minimum of a column | Minimum value |
max | Maximum of a column | Maximum value |
head | First N rows | First N rows |
tail | Last N rows | Last N rows |
columns | Get column names | Column name strings |
shape | Get row and column counts | {rows, columns} |
Functions
create
Create a table from array of objects or columns+rows
Module: table | Returns: array -- Array of row objects
table.create [{"name": "Alice", "age": 30}]
| Parameter | Type | Required | Description |
|---|---|---|---|
data | object | Yes | Array of objects or {columns, rows} |
select
Select specific columns
Module: table | Returns: array -- Table with selected columns
table.select $data ["name", "age"]
| Parameter | Type | Required | Description |
|---|---|---|---|
table | array | Yes | Table data |
columns | array | Yes | Column names to keep |
where
Filter rows by condition
Module: table | Returns: array -- Filtered rows
table.where $data "age" "gt" 25
| Parameter | Type | Required | Description |
|---|---|---|---|
table | array | Yes | Table data |
field | string | Yes | Column name |
operator | string | Yes | eq |
value | any | No | Comparison value |
orderBy
Sort rows by a field
Module: table | Returns: array -- Sorted table
table.orderBy $data "age" "desc"
| Parameter | Type | Required | Description |
|---|---|---|---|
table | array | Yes | Table data |
field | string | Yes | Column to sort by |
direction | string | No | asc or desc |
groupBy
Group rows by a field
Module: table | Returns: object -- Grouped rows keyed by field value
table.groupBy $data "department"
| Parameter | Type | Required | Description |
|---|---|---|---|
table | array | Yes | Table data |
field | string | Yes | Column to group by |
aggregate
Aggregate grouped data
Module: table | Returns: array -- Aggregated results
table.aggregate $data "dept" [{"field": "salary", "op": "avg"}]
| Parameter | Type | Required | Description |
|---|---|---|---|
table | array | Yes | Table data |
groupField | string | Yes | Column to group by |
aggregations | array | Yes | Array of {field, op: sum |
join
Join two tables
Module: table | Returns: array -- Joined table
table.join $users $orders "id" "userId" "left"
| Parameter | Type | Required | Description |
|---|---|---|---|
left | array | Yes | Left table |
right | array | Yes | Right table |
leftKey | string | Yes | Left join key |
rightKey | string | Yes | Right join key |
type | string | No | inner |
distinct
Remove duplicate rows
Module: table | Returns: array -- Deduplicated table
table.distinct $data ["name"]
| Parameter | Type | Required | Description |
|---|---|---|---|
table | array | Yes | Table data |
columns | array | No | Columns for uniqueness check |
limit
Take first N rows
Module: table | Returns: array -- First N rows
table.limit $data 10
| Parameter | Type | Required | Description |
|---|---|---|---|
table | array | Yes | Table data |
n | number | Yes | Number of rows |
offset
Skip first N rows
Module: table | Returns: array -- Remaining rows
table.offset $data 5
| Parameter | Type | Required | Description |
|---|---|---|---|
table | array | Yes | Table data |
n | number | Yes | Rows to skip |
addColumn
Add a column with a default value
Module: table | Returns: array -- Table with new column
table.addColumn $data "status" "active"
| Parameter | Type | Required | Description |
|---|---|---|---|
table | array | Yes | Table data |
columnName | string | Yes | New column name |
value | any | Yes | Default value |
removeColumn
Remove column(s)
Module: table | Returns: array -- Table without specified columns
table.removeColumn $data "temp"
| Parameter | Type | Required | Description |
|---|---|---|---|
table | array | Yes | Table data |
columns | any | Yes | Column name or array of names |
renameColumn
Rename a column
Module: table | Returns: array -- Table with renamed column
table.renameColumn $data "fname" "firstName"
| Parameter | Type | Required | Description |
|---|---|---|---|
table | array | Yes | Table data |
oldName | string | Yes | Current name |
newName | string | Yes | New name |
pivot
Pivot table
Module: table | Returns: array -- Pivoted table
table.pivot $data "product" "month" "sales" "sum"
| Parameter | Type | Required | Description |
|---|---|---|---|
table | array | Yes | Table data |
rowField | string | Yes | Row grouping field |
columnField | string | Yes | Column pivot field |
valueField | string | Yes | Value field |
aggOp | string | No | sum |
unpivot
Unpivot/melt table
Module: table | Returns: array -- Unpivoted table with key/value columns
table.unpivot $data ["name"] ["jan", "feb", "mar"]
| Parameter | Type | Required | Description |
|---|---|---|---|
table | array | Yes | Table data |
idColumns | array | Yes | Columns to keep |
valueColumns | array | Yes | Columns to melt |
count
Count rows
Module: table | Returns: number -- Row count
table.count $data
| Parameter | Type | Required | Description |
|---|---|---|---|
table | array | Yes | Table data |
sum
Sum a numeric column
Module: table | Returns: number -- Sum
table.sum $data "amount"
| Parameter | Type | Required | Description |
|---|---|---|---|
table | array | Yes | Table data |
field | string | Yes | Column name |
avg
Average a numeric column
Module: table | Returns: number -- Average
table.avg $data "score"
| Parameter | Type | Required | Description |
|---|---|---|---|
table | array | Yes | Table data |
field | string | Yes | Column name |
min
Minimum of a column
Module: table | Returns: number -- Minimum value
table.min $data "price"
| Parameter | Type | Required | Description |
|---|---|---|---|
table | array | Yes | Table data |
field | string | Yes | Column name |
max
Maximum of a column
Module: table | Returns: number -- Maximum value
table.max $data "price"
| Parameter | Type | Required | Description |
|---|---|---|---|
table | array | Yes | Table data |
field | string | Yes | Column name |
head
First N rows
Module: table | Returns: array -- First N rows
table.head $data 5
| Parameter | Type | Required | Description |
|---|---|---|---|
table | array | Yes | Table data |
n | number | No | Number of rows (default 5) |
tail
Last N rows
Module: table | Returns: array -- Last N rows
table.tail $data 5
| Parameter | Type | Required | Description |
|---|---|---|---|
table | array | Yes | Table data |
n | number | No | Number of rows (default 5) |
columns
Get column names
Module: table | Returns: array -- Column name strings
table.columns $data
| Parameter | Type | Required | Description |
|---|---|---|---|
table | array | Yes | Table data |
shape
Get row and column counts
Module: table | Returns: object -- {rows, columns}
table.shape $data
| Parameter | Type | Required | Description |
|---|---|---|---|
table | array | Yes | Table data |
Error Handling
All functions throw on failure. Common errors:
| Error | Cause |
|---|---|
| (standard errors) | Check function parameters and authentication |
@desc "Create and validate result"
do
set $result as table.create [{"name": "Alice", "age": 30}]
if $result != null
print "Success"
else
print "No result"
end
enddo
Recipes
1. Create a new item with create
Create a new resource and capture the result.
set $result as table.create [{"name": "Alice", "age": 30}]
print "Created: " + $result
2. Multi-step Table workflow
Chain multiple table operations together.
@desc "Create, select, and more"
do
set $r_create as table.create [{"name": "Alice", "age": 30}]
set $r_select as table.select $data ["name", "age"]
set $r_where as table.where $data "age" "gt" 25
print "All operations complete"
enddo
3. Safe create with validation
Check results before proceeding.
@desc "Create and validate result"
do
set $result as table.create [{"name": "Alice", "age": 30}]
if $result != null
print "Success: " + $result
else
print "Operation returned no data"
end
enddo
Related Modules
- json -- JSON module for complementary functionality
Versions (1)
| Version | Tag | Published |
|---|---|---|
| 0.1.1 | latest | 1 months ago |
Related Modules
chart
JS@robinpathv0.1.2
Generate chart images (PNG/JPEG) using Chart.js. Supports bar, line, pie, doughnut, scatter, radar, polarArea, and bubble charts with auto-coloring and customizable titles, legends, and dimensions.
firebase
JS@robinpathv0.1.1
Firebase module for RobinPath.
graph
JS@robinpathv0.1.1
Graph data structures with BFS, DFS, Dijkstra's shortest path, topological sort, cycle detection, and connectivity
hotjar
JS@robinpathv0.1.1
Hotjar module for RobinPath.
$ robinpath add @robinpath/table
