3.5.8.2 Ccatindex


Description

Returns the category index for each element of a categorical column, to a worksheet column.

Syntax

vector Catindex(vector vd)

Parameter

vd

a vector (column of categorical data) in an Origin worksheet.

Return

Returns the category index for each element of a categorical column vd.

Example

// create an empty book
newbook; 
// import the file automobile.dat into the new book
impASC fname:="C:\Program Files\OriginLab\Origin2020b\Samples\Statistics\automobile.dat";
// set column 2 as categorical and sort it in ascending order
wks.col2.categorical.type=2;
wks.col2.categorical.sort=1;
// add a new column H and use catindex function to fill it with the corresponding category index of element in column A
col(H)=catindex(col(B));

See Also

Category, Catrows, Cattext