Table Functions


These functions operate on general multi-dimensional tables that may contain string-valued indices, non numeric values, and sub-tables within tables. Their names add a terminal "n" to distinguish them from the simpler array functions that work only on 1-dimensional arrays. None of these functions accepts as an argument a numeric list, like {1,-2,6,12,5.7}.

Here are some benefits afforded by these functions:

bullet.gif    Most functions perform a mathematical operation on only the numeric values in the table. This permits the use of "self-documenting" numerical arrays. For example, the meann function can calculate the mean value of the array {"data from May 2022",1.5,2.411,3.7,1.99}.

bullet.gif    Several of these table functions can be used as the argument of another function. For example, the following table equation is possible: x = meann(muln(addn(tbl,20.5),0.42))). This statement adds 20.5 to every numeric value in the table tbl, then multiples the result by 0.42 and calculates the mean value of all elements in the final table.

addn

Adds a number to the numeric values in a general table.

divn

Divides a number into the numeric values in a general table.

flatten

Flattens the numeric values of a general table into a 1-dimensional array

flattenn

Flattens all values of a general table into a 1-dimensional array

harmeann

Calculates the harmonic mean of the numeric values in a general table.

harmeansdevn

Calculates the harmonic mean and standard deviation of the numeric values in a general table.

is_multidim

Returns true of the specified table has more than one dimension (i.e., contains at least one sub-table).

list

Lists the contents of a table.

maxn

Returns the maximum value in a general table.

meann

Returns the mean for the numeric values in a general table

meansdevn

Returns the mean and standard deviation for the numeric values in a general table

mediann

Returns the median for the numeric values in a general table.

mediansdevn

Returns the median and standard deviation for the numeric values in a general table.

minn

Returns the minimum value of the numeric values in a general table.

muln

Multiples the numeric values in a general table by a specified number.

normn

Normalizes the numeric values in a general table so their sum is 1.0.

rankn

Returns the specified rank value for numeric values in a general table.

sdevn

Returns the standard deviation of numeric values in a general table.

sdevxn

Returns the standard deviation about a specified value for a general table.

subn

Subtracts a number from the numeric values of a general table.

sumn

Returns the sum of numeric values in a general table.

tcountn

Returns the count of numeric elements in a general table.

xdivn

Divided each member of a general table into a specified number. This is often called "reverse division."

Related Topics

Contents

Table and Array Functions

Array Functions

lua table library


Mira Pro x64 Script User's Guide, v.8.77 Copyright Ⓒ 2024 Mirametrics, Inc. All Rights Reserved.