sort_def: Create a sort definition object

Description Usage Arguments Examples

View source: R/sort.r

Description

You can sort by aggregated value of another “sort” field by creating a sort field definition object. All three properties must be non-NULL.

Usage

1
sort_def(field, op = NULL, order = c("ascending", "descending"))

Arguments

field

the field name to aggregate over.

op

a valid aggregation operator.

order

either ascending or descending

Examples

1
2
3
4
5
vegalite() %>%
  add_data("https://vega.github.io/vega-editor/app/data/cars.json") %>%
  encode_x("Horsepower", type="quantitative", aggregate="mean") %>%
  encode_y("Origin", "ordinal", sort=sort_def("Horsepower", "mean")) %>%
  mark_bar()

vegalite documentation built on May 2, 2019, 10:46 a.m.