Skip to content

Please allow uncommented code output to R script with chunk options eval=FALSE purl=TRUE #2425

@alchemit

Description

@alchemit

It seems to be knitr::purl feature to comment out the code chunks with options eval=FALSE, purl=TRUE in the extracted R script, and I could not find a workaround (option coment="" doesn't help). Let me show some use cases where this feature is a show stopper:

  • The source document explains how to "play with data" on a specific example to achieve the desired result, but the extracted script should be usable with any data set. The script may thus ask the user about input/output file names or parameters relevant to its purpose. However, evaluation of something like readLines("stdin", n = 1) hangs the knitting process, at least in Rstudio.
  • The source document explains how to use the generated script, for example describing its command line options. Of course there are no CLI options when knitting so eval=FALSE makes perfect sense then, but the code should be working in the extracted script.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions