Learn R Programming

slackr (version 3.3.1)

ggslackr: 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,
  ...
)

Value

httr response object (invisibly)

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

Examples

Run this code
if (FALSE) {
slackr_setup()
ggslackr(qplot(mpg, wt, data = mtcars))
}

Run the code above in your browser using DataLab