3.5.8.3 Catrows


Description

Returns a pipe-separated list of all row indices by category, to a worksheet column.

Syntax

stringArray Catrows(vd)$

Parameter

vd

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

Return

Returns a pipe-separated listing of all row indices by category 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;
// get column 2 into range variable rA
range rA = [automobile]automobile!"Make";
// create a new book and use category function to copy categories in rA to column A of newbook
// to column B, add row indices of occurrence for each category, as a pipe-separated list 
// increase column width for visibility
newbook;
col(A)=category(rA)$;
col(B)=catrows(rA)$;
wks.col2.Width=50;

See Also

Category, Catindex, Cattext, text2cols (X-Function)