R: Guess the right type of layer based on current properties.

layer_guess {ggvis} | R Documentation

## Guess the right type of layer based on current properties.

### Description

`layer_guess` provides the magic behind the default behaviour of `ggvis`.

### Usage

    layer_guess(vis, ...)

### Arguments

`vis` | The visualisation to add the new layer to.
`...` | Other arguments passed on individual layers.

### Defaults

- Continuous x, `layer_histograms`

- Categorical x, `layer_bars`

- Continuous x and y, `layer_points`

### Examples

    # A scatterplot:
    mtcars %>% ggvis(~mpg, ~wt)
    mtcars %>% ggvis(~mpg, ~wt) %>% layer_guess()

    # A histogram:
    mtcars %>% ggvis(~mpg)
    mtcars %>% ggvis(~mpg) %>% layer_guess()

[Package ggvis version 0.4.3 Index]