Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

reprex & carbonate #14

Closed
maelle opened this issue Sep 25, 2018 · 11 comments
Closed

reprex & carbonate #14

maelle opened this issue Sep 25, 2018 · 11 comments

Comments

@maelle
Copy link

maelle commented Sep 25, 2018

The problem
I am wondering how to use carbonate and reprex together. I.e. I'd like something similar to choosing a new venue for reprex, that'd let me obtain a carbonate image and URL of the code I'd copied to clipboard, together with its output.

Describe solutions you've considered
I think it might only be a documentation need.

@yonicd
Copy link
Owner

yonicd commented Sep 25, 2018

Quick solution would be to run reprex.

The solution is placed on the clipboard by reprex.

Use the clipboard in a obj <- carbon$new().

Setting obj$add_tiny <- TRUE would add a tinyurl to the image.

@yonicd
Copy link
Owner

yonicd commented Sep 25, 2018

  • code to reprex
Simple <- R6::R6Class("Simple",
                  public = list(
                    x = 1,
                    getx = function() self$x
                  )
)

Simple$set('public','foo',list(NULL))

Simple$public_fields
  • run reprex to clipboard
Rendering reprex...
Rendered reprex is on the clipboard.
  • carbonate script to run
obj <- carbonate::carbon$new()
obj$add_tinyurl <- TRUE
obj$tiny()
[1] "http://tinyurl.com/yaz3cg88"
obj$carbonate()

reprex

@maelle
Copy link
Author

maelle commented Sep 25, 2018

Nice! Only improvement I'd see would be to use venue=r in reprex. Do you want me to make a PR to document this "somewhere"?

@yonicd
Copy link
Owner

yonicd commented Sep 25, 2018

indeed the venue should be r good catch.

reprex

If you could make a PR that would be great! probably a vignette, seeing that the Readme is already overloaded and needs to be trimmed anyways. (If you want to add it as a new details chunk in the sharing subsection of the Readme that is also great, when I get a chance I can reorganize).

I'm interested to know what the use case you had in mind to combine the two outputs?

Thanks!

@maelle
Copy link
Author

maelle commented Sep 25, 2018

Will write a vignette soon then!

The reason for my asking is that I'm preparing a talk including a section about where/how to get help. It'll include a reprex demo. Now I'm curious how to make reprex interact with carbonate to show how one could e.g. tweet a question.

One workflow I had in mind but that's maybe a bit cumbersome to show some code (buggy or not) would involve a reprex, reprex, gistr and carbonate (just as a way to advertise the thing on Twitter/Slack with a nice pic, and with the gist URL as URL).

No well-formed ideas yet though.

@yonicd
Copy link
Owner

yonicd commented Sep 25, 2018

sounds cool. you can directly tweet from the carbon object.

@yonicd
Copy link
Owner

yonicd commented Sep 25, 2018

it would be cool if the venue for reprex could be gist and then it would set up for you the gist with the reprexed code and add the gist link to the footer of the reprex output to clipr.

@maelle
Copy link
Author

maelle commented Sep 25, 2018

Cf tidyverse/reprex#190

@cderv
Copy link

cderv commented Sep 29, 2018

it would be cool if the venue for reprex could be gist

I would find this cool too ! 😉 It still is in my TODO. Should prioritize that maybe... 🤔
Thanks for the cross-referencing @maelle.

Using carbonate and reprex together was also on my mind. I try to have a look at what you already have done!

@maelle
Copy link
Author

maelle commented Sep 29, 2018

My experiments https://github.com/maelle/reprex_demo

I will contribute a README section to carbonate (rather than a vignette) once I can take a screenshot cf #15

@yonicd
Copy link
Owner

yonicd commented Oct 2, 2018

closing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants