Skip to content

Skip eval=FALSE chunks #1964

Closed
Closed

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.

Activity

  1. added
    feature
    on Apr 19, 2023
  2. MichaelChirico commented on Sep 14, 2023

    @MichaelChirico
    CollaboratorAuthor

    This is coming up a fair amount for library_call_linter(), where in addition to #2161's issue with setup chunks, there are often eval=FALSE chunks up front advising the user how to install the package. Unless we can skip those chunks, library_call_linter() will be of limited utility to Rmd files.

  3. modified the milestones: 3.1.2, 3.2.0 on Oct 12, 2023
  4. modified the milestones: 3.3.0, 3.4.0 on Jul 29, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    featurermd

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions