SetCategories Method (R)
.SetCategories(object,dim,categories). Sets categories for the specified dimension. The argument object is a reference
to the associated BasePivotTable
object. The argument dim is a
reference to the dimension object for which categories are to be set.
Dimensions are created with the Append or Insert method. The argument categories is a single value or a list of
unique values, each of which is a CellText object
(one of CellText.Number
, CellText.String
, CellText.VarName
, or CellText.VarValue
).
Example
table = spss.BasePivotTable("Table Title",
"OMS table subtype")
rowdim=BasePivotTable.Append(table,Dimension.Place.row,"rowdim")
coldim=BasePivotTable.Append(table,Dimension.Place.column,"coldim")
row_cat1 = spss.CellText.String("row1")
row_cat2 = spss.CellText.String("row2")
col_cat1 = spss.CellText.String("column1")
col_cat2 = spss.CellText.String("column2")
BasePivotTable.SetCategories(table,rowdim,list(row_cat1,row_cat2))
BasePivotTable.SetCategories(table,coldim,list(col_cat1,col_cat2))
Examples of using the SetCategories
method are most easily understood in the
context of going through the steps to create a pivot table. See the topic General Approach to Creating Pivot Tables (R) for more information.