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

Add comment character parameter #33

alistaire47 opened this issue Sep 11, 2016 · 1 comment

Add comment character parameter #33

alistaire47 opened this issue Sep 11, 2016 · 1 comment


Copy link

@alistaire47 alistaire47 commented Sep 11, 2016

Currently, if I run

reprex::reprex({x <- rnorm(100) ; mean(x)}, venue = 'gh', show = FALSE)

I get the code for

x <- rnorm(100)
#> [1] 0.06771625

which is wonderful! However, changing the comment character, e.g. to ## is more complicated, requiring (as suggested on Twitter) copying

#+ include=FALSE
knitr::opts_chunk$set(comment = '##')

#+ realstuff
x <- rnorm(100)

and then calling reprex::reprex() to get the code for

x <- rnorm(100)
## [1] 0.04698201

To make this process simpler, could we get a comment character parameter in reprex akin to formatR::tidy_eval's prefix?

@jennybc jennybc closed this in 974a9ab Nov 13, 2016
Copy link

@jennybc jennybc commented Nov 13, 2016

OK you can do this now like so:

reprex::reprex({x <- rnorm(100) ; mean(x)}, venue = 'gh',
               opts_chunk = list(comment = '##'))

That generates this:

x <- rnorm(100) ; mean(x)
## [1] -0.04785671

This can be used to provide general knitr chunk and package options and, in particular, the one you wanted to modify.

jennybc pushed a commit that referenced this issue Dec 31, 2016
Relates to #33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants