ggslackr: Post a ggplot to a Slack channel

View source: R/gg_slackr.R

ggslackrR Documentation

Post a ggplot to a Slack channel

Description

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

Usage

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

Value

httr response object (invisibly)

Examples

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

## End(Not run)

slackr documentation built on March 7, 2023, 8 p.m.