BasePivotTable Class (R)
spss.BasePivotTable(title,templateName,outline,isSplit,caption). Provides the ability to create custom pivot tables that can be displayed in the IBM® SPSS® Statistics Viewer or written to an external file using the IBM SPSS Statistics Output Management System.
Note: If you only need a pivot table with a single column dimension and a single row dimension, you may want to use the much simpler spsspivottable.Display function.
- The argument title is a string that specifies the title
that appears with the table. Each table associated with a set of output
(as specified in a
StartProcedure-EndProcedure
block) should have a unique title. Multiple tables within a given procedure can, however, have the same value of the title argument as long as they have different values of the outline argument. - The argument templateName is a string that specifies the OMS (Output Management System) table subtype for this table. It must begin with a letter and have a maximum of 64 characters. Unless you are routing this pivot table with OMS, you will not need to keep track of this value, although you do have to provide a value that meets the stated requirements.
- The optional argument outline is a string that specifies a title, for the pivot table, that appears in the outline pane of the Viewer. The item for the table itself will be placed one level deeper than the item for the outline title. If omitted, the Viewer item for the table will be placed one level deeper than the root item for the output containing the table.
- The optional Boolean argument isSplit specifies whether
to enable split processing when creating pivot tables from data that
have splits. Split file processing refers to whether results from
different split groups are displayed in separate tables or in the
same table but grouped by split, and is controlled by the
SPLIT FILE
command. By default, split processing is enabled. To disable split processing for pivot tables, specifyisSplit=FALSE
.When retrieving data with
spssdata.GetSplitDataFromSPSS
, simply repopulate the pivot table cells with the results for each new split group. The results from each split group are accumulated and the subsequent table(s) are displayed whenspssdata.CloseDataConnection
is called. - The optional argument caption is a string that specifies a table caption.
Note: An instance of the BasePivotTable
class
can only be used within an spsspkg.StartProcedure-spsspkg.EndProcedure
block.
See Setting Cell Values for an example.
The figure below shows the basic structural components of a pivot table. Pivot tables consists of one or more dimensions, each of which can be of the type row, column, or layer. In this example, there is one dimension of each type. Each dimension contains a set of categories that label the elements of the dimension--for instance, row labels for a row dimension. A layer dimension allows you to display a separate two-dimensional table for each category in the layered dimension--for example, a separate table for each value of minority classification, as shown here. When layers are present, the pivot table can be thought of as stacked in layers, with only the top layer visible.
Each cell in the table can be specified by a combination of category values. In the example shown here, the indicated cell is specified by a category value of Male for the Gender dimension, Custodial for the Employment Category dimension, and No for the Minority Classification dimension.
