Encode text "channel"

Share:

Description

Encode text "channel"

Usage

1
encode_text(vl, field, type, value = NULL, aggregate = NULL, sort = NULL)

Arguments

vl

Vega-Lite object created by vegalite

field

single element character vector naming the column. Can be * is using aggregate.

type

the encoded field’s type of measurement. This can be either a full type name (quantitative, temporal, ordinal, and nominal) or an initial character of the type name (Q, T, O, N). This property is case insensitive. If auto is used, the type will be guessed (so you may want to actually specify it if you want consistency).

value

scale value

aggregate

perform aggregaton on field. See Supported Aggregation Options for more info on valid operations. Leave NULL for no aggregation.

sort

either one of ascending, descending or (for ordinal scales) the result of a call to sort_def

Note

right now, type == "auto" just assume "quantitative". It will eventually get smarter, but you are better off specifying it.

References

Vega-Lite Encoding spec

Examples

1
2
3
4
5
6
7
8
9
vegalite() %>%
  cell_size(300, 200) %>%
  add_data("https://vega.github.io/vega-editor/app/data/cars.json") %>%
  encode_x("Horsepower", "quantitative") %>%
  encode_y("Miles_per_Gallon", "quantitative") %>%
  encode_color("Origin", "nominal") %>%
  calculate("OriginInitial", "datum.Origin[0]") %>%
  encode_text("OriginInitial", "nominal") %>%
  mark_text()

Want to suggest features or report bugs for rdrr.io? Use the GitHub issue tracker.