Package smile.plot.vega
Class PivotTransform
java.lang.Object
smile.plot.vega.PivotTransform
The pivot transform maps unique values from a field to new aggregated
fields (columns) in the output stream. The transform requires both a
field to pivot on (providing new field names) and a field of values
to aggregate to populate the new cells. In addition, any number of
groupby fields can be provided to further subdivide the data into
output data objects (rows).
Pivot transforms are useful for creating matrix or cross-tabulation
data, acting as an inverse to the fold transform.
-
Method Details
-
toString
-
toPrettyString
Returns the specification in pretty print.- Returns:
- the specification in pretty print.
-
limit
Sets the maximum number of pivoted fields to generate. The default (0) applies no limit. The pivoted pivot names are sorted in ascending order prior to enforcing the limit.- Parameters:
limit
- the maximum number of pivoted fields to generate. 0 applies no limit.- Returns:
- this object.
-
groupby
Sets the data fields to group by. If not specified, a single group containing all data objects will be used.- Parameters:
fields
- The data fields to group by. If not specified, a single group containing all data objects will be used.- Returns:
- this object.
-
op
Sets the aggregation operation to apply to grouped value field values. Default value: sum- Parameters:
op
- The aggregation operation to apply to grouped value field values.- Returns:
- this object.
-