Skip to contents

Add PivotTransform to a vega-lite spec.

Usage

vl_pivot(
  spec,
  pivot = NULL,
  value = NULL,
  groupby = NULL,
  limit = NULL,
  op = NULL,
  .object = NULL
)

Arguments

spec

An input vega-lite spec

pivot

The data field to pivot on. The unique values of this field become new field names in the output stream.

value

The data field to populate pivoted fields. The aggregate values of this field become the values of the new pivoted fields.

groupby

The optional data fields to group by. If not specified, a single group containing all data objects will be used.

limit

An optional parameter indicating 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. Default value: 0

op

The aggregation operation to apply to grouped value field values. Default value: sum

.object

Directly input an object, rather than creating one via the other arguments. Should not be used in conjunction with the other arguments other than spec. Objects can be of type: PivotTransform

Value

A modified Vega-Lite Spec