auto_group: Automatically group data by grouping variables

Description Usage Arguments See Also Examples

View source: R/compute_auto_group.R

Description

Use auto_group to group up a dataset on all categorical variables specified by props, and have each piece rendered by the same mark.

Usage

1
auto_group(vis, exclude = NULL)

Arguments

vis

The ggvis visualisation to modify.

exclude

A vector containing names of props to exclude from auto grouping. It is often useful to exclude c("x", "y"), when one of those variables is categorical.

See Also

To manually specify grouping variables, see group_by.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
# Make cyl a factor (as it really should be)
mtcars2 <- mtcars
mtcars2$cyl <- factor(mtcars2$cyl)

# One line
mtcars2 %>% ggvis(~disp,  ~mpg, stroke = ~cyl) %>% layer_paths()
# One line for each level of cyl
mtcars2 %>% ggvis(~disp,  ~mpg, stroke = ~cyl) %>% group_by(cyl) %>%
  layer_paths()
mtcars2 %>% ggvis(~disp,  ~mpg, stroke = ~cyl) %>% auto_group() %>%
  layer_paths()

rpruim/ggvis2 documentation built on May 28, 2019, 2:34 a.m.