slackreprex
slackreprex
is a part of slackverse
Get Data from Slack | Manage Slack | Send Data to Slack |
---|---|---|
slackcalls |
||
slackthreads |
slackteams ⬅️➡️ |
slackblocks ⬇️ |
slackreprex |
The goal of slackreprex
is to post reprex outputs to Slack using
slackblocks
.
Installation
# install.packages("remotes")
remotes::install_github("yonicd/slackreprex")
Setup
To set up the required Slack Token API to interact with Slack teams you are a part of you need to first install slackteams and follow the instructions on create an incoming webhook (don’t worry there is a button to press for this)
Once you finish this process you are ready to try out the following example!
Example
library(slackreprex)
library(magrittr)
Load and Activate a Team
# load teams stored in '~/.slackteams'
slackteams::load_teams()
# using the first loaded team
team <- slackteams::get_teams()[1]
# activating the team
slackteams::activate_team(team)
Post Reprex!
You can post a reprex to a public channel, a private channel, a direct message, or a group private message.
You can attach a message before the reprex with text
that states your
problem in your own words. The reprex itself will be automatically be
placed in a thread so the channel won’t get too noisy and the help you
receive is self contained in the original question.
slack_reprex({
x <- 10
hist(runif(x))
hist(runif(2*y))
},
text = 'My question is ...) ',
channel = 'yonicd')
Notice the little flashing siren emoji. Those pop up automatically when an error is found in the reprex chunk.
Threads
You can also post into an active thread. Click on the three vertical dots (‘more actions’) on the message you are responding to and select ‘Copy link’.
Use this link in the channel argument. That’s it…
slack_reprex({
x <- 10
hist(runif(x))
hist(runif(2*x))
},
text = 'My correction is ... ',
channel = 'https://rfordatascience.slack.com/archives/DM4KNRWBY/p1582253357008800')
Post sessioninfo
You can also post your session info. If you have
sessioninfo installed then that
will be used by default, if you don’t then sessionInfo()
will be used.
The output will be posted to the channel as a snippet
as the output
can be pretty long and it is simpler to manage in this form.
slackreprex::post_sessioninfo('yonicd')