You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have created a new and empty Quarto Book (RStudio IDE: New Project -> Quarto Book -> tick "use renv") which uses expressions in eval, for example
```{r}
#| eval: !expr knitr::is_html_output()
# this is run only in the html version
# alternatively knitr::is_latex_output() for code that is only run in the pdf output
```
The issue is that packages that are only used in the chunks with eval expressions are not picked up by renv.
Eg in the newly created quarto book, I have this index.qmd (other files are unchanged):
# Preface {.unnumbered}
```{r}
#| eval: !expr knitr::is_html_output()
# This is not picked up
tibble::tibble(x = 1:3, y = 3:1)
```
```{r}
# this is picked up correctly
data.table::datab.table(x = 1:3, y = 3:1)
```
When I run renv::dependencies(), I get this output:
Thanks for the bug report. renv tries to skip parsing chunks for dependencies when eval is non-TRUE, or is set to a non-constant value which would require evaluation.
Perhaps we should consider some subset of eval expressions which we would consider safe to evaluate?
Isn't the opposite better, if eval is not false, evaluate the dependencies of the chunk. That should be an easy fix that should catch most use cases with some false positives (but I think renv detecting too many dependencies is better than it detecting too few).
I have created a new and empty Quarto Book (RStudio IDE: New Project -> Quarto Book -> tick "use renv") which uses expressions in eval, for example
The issue is that packages that are only used in the chunks with eval expressions are not picked up by renv.
Eg in the newly created quarto book, I have this
index.qmd
(other files are unchanged):When I run
renv::dependencies()
, I get this output:which shows that the tibble dependency is not picked up.
I would expect that tibble is also picked up as it is used.
I am using renv version 1.0.3 (latest on CRAN at the time of writing).
The text was updated successfully, but these errors were encountered: