columnNames

Syntax

columnNames(X)

Arguments

X is a matrix/table.

Details

Return the column names of X as a vector. Please check related function: rowNames.

Examples

$ x=1..6$2:3;
$ x;

#0

#1

#2

1

3

5

2

4

6

$ x.rename!(`a`b`c);

a

b

c

1

3

5

2

4

6

$ x.columnNames();
["a","b","c"]

$ t = table(1 2 3 as id, 4 5 6 as value, `IBM`MSFT`GOOG as name);
$ t;

id

value

name

1

4

IBM

2

5

MSFT

3

6

GOOG

$ columnNames t;
["id","value","name"]

$ t[t.columnNames().tail()];
["IBM","MSFT","GOOG"]
// retrieve the last column of a table as a vector