cols

Syntax

cols(X)

Arguments

X is a vector/matrix/table.

Details

Return the total number of columns in X. Please check related function: rows.

Examples

x=1..6$2:3;
x;
#0 #1 #2
1 3 5
2 4 6
cols x;
// output
3

a=table(1..3 as x,`IBM`C`AAPL as y);
a;
x y
1 IBM
2 C
3 AAPL
cols a;
// output
2

y=1 2 3;
cols(y);
// output
1  // a vector can be viewed as an n*1 matrix