Create a plot datamation from a tidyverse pipeline.

datamation_sanddance(
  pipeline,
  envir = rlang::global_env(),
  pretty = TRUE,
  elementId = NULL,
  height = 300,
  width = 300
)

Arguments

pipeline

Tidyverse pipeline

envir

Environment where code is evaluated. Defaults to the global environment.

pretty

Whether to pretty the JSON output. Defaults to TRUE.

elementId

Optional ID for the widget element.

height

Height of the plotting area of the widget (excluding axes and legends). This is an approximation and not an exact science, since sizes may vary depending on labels, legends, facets, etc! Defaults to 300 (pixels).

width

Width of the plotting area of the widget (excluding axes and legends). This is an approximation and not an exact science, since sizes may vary depending on labels, legends, facets, etc! Defaults to 300 (pixels).

Examples

{
  library(dplyr)

  "small_salary %>%
  group_by(Degree) %>%
  summarize(mean = mean(Salary))" %>%
    datamation_sanddance()

  library(ggplot2)

  "small_salary %>%
  group_by(Work, Degree) %>%
  summarize(mean_salary = mean(Salary)) %>%
  ggplot(aes(x = Work, y = mean_salary)) +
  geom_point() +
  facet_grid(rows = vars(Degree))" %>%
    datamation_sanddance()
}
#> 
#> Attaching package: ‘dplyr’
#> The following objects are masked from ‘package:stats’:
#> 
#>     filter, lag
#> The following objects are masked from ‘package:base’:
#> 
#>     intersect, setdiff, setequal, union
#> Warning: Returning more (or less) than 1 row per `summarise()` group was deprecated in
#> dplyr 1.1.0.
#>  Please use `reframe()` instead.
#>  When switching from `summarise()` to `reframe()`, remember that `reframe()`
#>   always returns an ungrouped data frame and adjust accordingly.
#>  The deprecated feature was likely used in the datamations package.
#>   Please report the issue to the authors.