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

Closed
alistaire47 opened this issue Sep 11, 2016 · 1 comment
Closed

Add comment character parameter #33

alistaire47 opened this issue Sep 11, 2016 · 1 comment

Comments

@alistaire47
Copy link
Contributor

Currently, if I run

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

I get the code for

x <- rnorm(100)
mean(x)
#> [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)
mean(x)

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

x <- rnorm(100)
mean(x)
## [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
Copy link
Member

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
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

2 participants