3.5.8.1 Category

Description

Returns all categories of a Categorical column, to a worksheet column.

Syntax

stringArray Category(vd)$

Parameter

vd

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

Return

Returns a dataset of all categories of a categorical column vd.

Example

EX1

//fill col(A) with "q w q e e", and set as categorical
col(B)=category(col(A))$;//q w e

EX2

// 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

LabTalk:Catrows (function)