ggslackr function

Post a ggplot to a Slack channel

Post a ggplot to a Slack channel

Unlike the slackr_dev() function, this one takes a ggplot object, eliminating the need to have a graphics device (think use in scripts).

ggslackr( plot = ggplot2::last_plot(), channels = Sys.getenv("SLACK_CHANNEL"), token = Sys.getenv("SLACK_TOKEN"), file = "ggplot.png", initial_comment = NULL, thread_ts = NULL, title = NULL, ... )

Arguments

  • plot: ggplot object to save, defaults to last plot displayed.
  • channels: Comma-separated list of channel names or IDs where the file will be shared.
  • token: Authentication token bearing required scopes.
  • file: Prefix for filenames (defaults to ggplot).
  • initial_comment: The message text introducing the file in specified channels.
  • thread_ts: Provide another message's ts value to upload this file as a reply. Never use a reply's ts value; use its parent instead.
  • title: Title of file.
  • ...: other arguments passed to ggsave

Returns

httr response object (invisibly)

Examples

## Not run: slackr_setup() ggslackr(qplot(mpg, wt, data = mtcars)) ## End(Not run)