Dataset with state management https://github.com/antvis/data-set

alter(data, ..., source = NULL, .rename = TRUE, .rows = TRUE,
  .return = NULL)

Arguments

data

A data.frame to alter.

...

Altering options.

source

A list of source options.

.rename

Whether to rename the columns of the altered data.frame (recommended).

.rows

Wheter to return the whole altered object or just the rows.

.return

Method to return, i.e."rows".

Examples

head(fruits)
#> # A tibble: 4 x 2 #> fruit value #> <chr> <dbl> #> 1 Apples 0.45 #> 2 Bananas 0.15 #> 3 Pears 0.35 #> 4 Oranges 0.05
fr <- fruits %>% dplyr::mutate(value = value * 100) %>% dplyr::select(name = fruit, value) %>% alter(type = "waffle", maxCount = 500, rows = 12) head(fr)
#> name value x y wStep hStep #> 1 Apples 45 0.05555556 0.0375 0.1111111 0.075 #> 2 Apples 45 0.05555556 0.1125 0.1111111 0.075 #> 3 Apples 45 0.05555556 0.1875 0.1111111 0.075 #> 4 Apples 45 0.05555556 0.2625 0.1111111 0.075 #> 5 Apples 45 0.05555556 0.3375 0.1111111 0.075 #> 6 Apples 45 0.05555556 0.4125 0.1111111 0.075
g2(fr, asp(x, y, shape = "square", size = 10, color = name)) %>% fig_point(axes = FALSE) %>% gauge_axis(x, FALSE)