Combine two tables or timetables by rows using key variables

combines tables or timetables `T`

= join(`Tleft`

,`Tright`

)`Tleft`

and `Tright`

using key
variables. All variables with the same names in both tables are key
variables. A table join appends rows from the right table where its key variables
match values in the key variables of the left table. For example, if
`Tleft`

has variables named `Key1`

and
`Var1`

, and `Tright`

has variables
`Key1`

and `Var2`

, then
`T=join(Tleft,Tright)`

uses `Key1`

as a key
variable.

The matching values of the key variables in the left and right tables do not have
to be in the same order. Also, the key variables of `Tright`

must
contain all values in the key variables of `Tleft`

. Each value must
occur only once in the key variables of `Tright`

, but can occur
multiple times in the key variables of `Tleft`

.

The inputs can be tables, timetables, or one of each.

If

`Tleft`

is a table, then`join`

returns`T`

as a table.If

`Tleft`

is a timetable, then`join`

returns`T`

as a timetable.

The vectors of row labels of `Tleft`

and
`Tright`

can be key variables. Row labels are the row names of
a table, or the row times of a timetable.

joins the tables or timetables with additional options specified by one or more
`T`

= join(`Tleft`

,`Tright`

,`Name,Value`

)`Name,Value`

pair arguments.

For example, you can specify which variables to use as key variables.

The `join`

function first finds one or more key variables. Then,
`join`

uses the key variables to find the row in input table
`Tright`

that matches each row in input table
`Tleft`

, and combines those rows to create a row in output table
`T`

.

If there is a one-to-one mapping between key values in

`Tleft`

and`Tright`

, then`join`

sorts the data in`Tright`

and appends it to table`Tleft`

.If there is a many-to-one mapping between key values in

`Tleft`

and`Tright`

, then`join`

sorts and repeats the data in`Tright`

before appending it to table`Tleft`

.If there is data in a key variable of

`Tright`

that does not map to a key value in`Tleft`

, then`join`

does not include that data in the output table,`T`

.