Skip to content

eval is about expressions, not lines #12164

Closed
@fkohrt

Description

@fkohrt

What would you like to do?

Report an issue on quarto.org

Description

The documentation on the eval option currently says the following:

A list of positive or negative line numbers to selectively include or exclude lines (explicit inclusion/excusion of lines is available only when using the knitr engine)

However, this is not correct. Take the following document:

---
title: "Test"
format: html
engine: knitr
---

```{r}
#| eval = -2
if (TRUE) {
  print(1)
  print(2)
}
print(3)
print(4)
```

If the number provided to eval were about lines, then 1 should not get printed. However, it is 3 which does not get printed, because the number provided to eval is about expressions. This is also evident from the corresponding documentation for knitr:

It can also be a numeric vector to choose which R expression(s) to evaluate, e.g., eval = c(1, 3, 4) will evaluate the first, third, and fourth expressions, and eval = -(4:5) will evaluate all expressions except the fourth and fifth.

Metadata

Metadata

Assignees

Labels

documentationDoc improvements & quarto-web

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions