Terraflux Terraflux
Download

Tables

10 operators. Inputs marked required must be connected or given; the others have defaults.

table.aggregate#

Rows grouped by the values of some columns and summarised, as dplyr's group_by and summarise: a row per group (the groups in the order of their values), its columns n (the rows in the group) and, for every column summarised and statistic, column_statistic (area_sum, area_mean). Missing values are left out of the statistics; sd is the sample's (n - 1, as R's sd). Without columns to group by, the whole table is one group.

InputTypeWhat it is
tablerequiredtablethe table
OutputTypeWhat it is
tabletablea row per group
SettingTypeWhat it is
byanythe columns to group by: a name, names separated by commas or a list (none: one group)
columnsanythe columns summarised (default: every other)
statsanythe statistics: sum, mean, count, min, max, sd, median (default sum)

table.calc#

A column computed row by row from an expression over the others, as a spreadsheet's field calculator or dplyr's mutate: the expressions of map algebra (area / 10000, cells if class == 1 else 0), the node's other inputs as numbers by their names. A column of the same name is replaced, else it is added at the end.

InputTypeWhat it is
tablerequiredtablethe table
OutputTypeWhat it is
tabletablethe table with the column
SettingTypeWhat it is
columnrequiredtextthe column's name
expressionrequiredtextits value at every row, e.g. area / 10000

Takes any other inputs by name (any).

table.filter#

The rows of a table where an expression is true, as dplyr's filter: the columns by their names, the expressions of map algebra (class == 3 and area > 10; isnull(x) for a missing value), the node's other inputs as numbers by their names. A row where the expression is missing is left out.

InputTypeWhat it is
tablerequiredtablethe table
OutputTypeWhat it is
tabletableits rows where the expression is true
SettingTypeWhat it is
expressionrequiredtextwhat a row kept is, e.g. class == 3 and area > 10

Takes any other inputs by name (any).

table.join#

Two tables joined by key columns, as dplyr's joins: every row of the left with each row of the right of the same key (left: the left's rows without one kept, the right's columns missing; inner: only the rows of keys in both; full: the right's rows without one added too). The right's other columns follow the left's; one of a name the left has takes a suffix.

InputTypeWhat it is
leftrequiredtablethe left table
rightrequiredtablethe right table
OutputTypeWhat it is
tabletablethe tables joined
SettingTypeWhat it is
onrequiredanythe key columns, of the same names in both: a name, names separated by commas or a list
right_onanythe right's key columns, when they are named otherwise (as many as on)
howtextleft, inner or full (default left)
suffixtextadded to a right's column of a name the left has (default _right)

table.of#

A table written in the settings: its columns' names and its rows of numbers (null: no value), such as the small tables a planning problem takes.

OutputTypeWhat it is
tabletablethe table
SettingTypeWhat it is
columnsrequiredanythe columns' names
rowsrequiredanythe rows: [[number, ...], ...], as many numbers as columns

table.pivot#

A table from long to wide or back, as tidyr's pivot_wider and pivot_longer. Wider: a row per value of the id columns, a column per value of the names column (named prefix and the value: to_1, to_2...) holding the values column (transitions from, to, cells into a matrix). Longer: the columns given (or every column but the id ones) into rows of two columns, the names and the values; a table's values being numbers, the name of a column is the number in it (2011 of y2011 with prefix y; 1 of to_1), else its place among them (1, 2...).

InputTypeWhat it is
tablerequiredtablethe table
OutputTypeWhat it is
tabletablethe table pivoted
SettingTypeWhat it is
directionrequiredtextwider or longer
idanythe columns that make a row (wider), or kept as they are (longer)
namestextwider: the column whose values become columns
valuestextwider: the column whose values fill them
prefixtextthe new columns' names before the value (wider), or before the number in the names (longer) (default: the names column's name and _)
fillnumberwider: the value of a combination absent (default none)
columnsanylonger: the columns turned into rows (default every one but the id ones)
names_totextlonger: the column of the names (default name)
values_totextlonger: the column of the values (default value)

table.read#

A table from a file: comma-separated values (.csv), tab-separated (.tsv, .txt), with ; as Excel writes them where a comma marks the decimals (the separator and the decimal mark found by themselves), or JSON (.json, a list of rows). A header names the columns; an empty value, or NA, is none. The columns of text (names, not numbers) are left out: a table is of numbers.

OutputTypeWhat it is
tabletablethe table
SettingTypeWhat it is
pathrequiredtextthe file, relative to the model's folder
separatortextbetween the values: , ; or tab (default: found)
decimaltextthe decimal mark: . or , (default: found)

table.select#

Columns of a table chosen (in the order given), left out, or renamed, as dplyr's select and rename.

InputTypeWhat it is
tablerequiredtablethe table
OutputTypeWhat it is
tabletableits columns chosen
SettingTypeWhat it is
columnsanythe columns kept, in this order (default every one)
dropanythe columns left out
renameanynew names: { old = "new", ... }

table.sort#

The rows of a table sorted by some columns (the first, then the next where it ties; missing values last), as dplyr's arrange, and the first rows kept (top: the ten largest patches, say).

InputTypeWhat it is
tablerequiredtablethe table
OutputTypeWhat it is
tabletableits rows sorted
SettingTypeWhat it is
byrequiredanythe columns to sort by: a name, names separated by commas or a list
descendingboolfrom the largest (default false)
topintegerthe first rows kept (default every row)

table.write#

Write a table to a file, its format by the extension: comma-separated values (.csv, the default), tab-separated (.tsv, .txt) or JSON (.json, a list of rows); a value missing is left empty (null in JSON). For a spreadsheet that reads a comma as the decimal mark: separator ; and decimal ,.

InputTypeWhat it is
tablerequiredtablethe table
OutputTypeWhat it is
pathtextthe file written
SettingTypeWhat it is
pathrequiredtextthe file, relative to the model's folder
separatortextbetween the values: , ; or tab (default by the extension)
decimaltextthe decimal mark: . (default) or ,