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

Comments

Projects
None yet
2 participants
@alistaire47
Contributor

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)
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 jennybc closed this in 974a9ab Nov 13, 2016

@jennybc

This comment has been minimized.

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