Learn R Programming

slackr (version 2.0.1)

slackr: Output R expressions to a Slack channel/user

Description

Takes an expr, evaluates it and sends the output to a Slack chat destination. Useful for logging, messaging on long compute tasks or general information sharing.

Usage

slackr(
  ...,
  channel = Sys.getenv("SLACK_CHANNEL"),
  username = Sys.getenv("SLACK_USERNAME"),
  icon_emoji = Sys.getenv("SLACK_ICON_EMOJI"),
  bot_user_oauth_token = Sys.getenv("SLACK_BOT_USER_OAUTH_TOKEN")
)

Arguments

...

expressions to be sent to Slack

channel

which channel to post the message to (chr)

username

what user should the bot be named as (chr)

icon_emoji

what emoji to use (chr) "" will mean use the default

bot_user_oauth_token

Slack bot user OAuth token

Details

By default, everything but expr will be looked for in a "SLACK_" environment variable. You can override or just specify these values directly instead, but it's probably better to call slackr_setup first.

See Also

slackr_setup, slackr_bot, dev_slackr, save_slackr, slackr_upload

Examples

Run this code
# NOT RUN {
slackr_setup()
slackr("iris info", head(iris), str(iris))
# }

Run the code above in your browser using DataLab