Skip to content

Skip eval=FALSE chunks #1964

@MichaelChirico

Description

@MichaelChirico

Resurrection of #581.

As noted there, we can't get a fully general solution, as run-time usage of opts_chunk$set(eval = FALSE) is very hard to detect.

Still, I think it's feasible for us to look at chunk-level options as an improvement over status quo. The key will be using knitr:::parse_params():

https://github.com/yihui/knitr/blob/e8aae19fcc7443b8a212c8dc65ba2b83894f1fe0/R/parser.R#L174

which takes as input a string like "x, eval = stop('haha')" and outputs a key-value list like list(label = "x", eval = quote(stop('haha'))).

Parsing chunk params is also something we want for #773.

At a glance, using eval = FALSE is a very common way to tell knitr to skip R chunks:

https://github.com/search?q=filename%3ARmd+%22eval+%3D+FALSE%22

It looks like GH search can't help us find "```r" usage; I also don't see any usage of opts_chunk$set(eval = FALSE):

https://github.com/search?q=filename%3ARmd+%22opts_chunk%24set%22%2C+%22eval+%3D+FALSE%22

So I think this issue is pretty high-impact & value, even if imperfect.

Metadata

Metadata

Assignees

No one assigned

    Labels

    featurea feature request or enhancementrmd

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions