Purpose¶

Set columns in a matrix to have variable names and types.

Format¶

x_meta = setColMetadata(X, varnames, types)
Parameters: X (NxK matrix) – data. varnames (Kx1 string array) – Names to apply to column in X. types (Kx1 vector) – Specifies types to be assigned to names in varnames. Valid options include: 0: string, 1: number, 2: categorical 3: date. x_meta (NxK dataframe) – Data with column names in varnames and types in types assigned to the columns.

Note¶

The following variables are equal to their corresponding values in the description of types above:

• META_TYPE_STRING
• META_TYPE_NUMBER
• META_TYPE_CATEGORY
• META_TYPE_DATE

They may be used as shown in the example below.

Examples¶

// We will interpret the first column as a posix date
// meaning the number of seconds since Jan 1, 1970
x = { 1e6 23,
1e7 19 };

// Specify types
types = META_TYPE_DATE | META_TYPE_NUMBER;

// Specify variable names
varnames = "Departure"\$|"Age";

// Assign variable names to all three columns
// and create new matrix x_meta

 Departure    Age