I have run into a strange error rendering in Quarto that appears to be a scope problem. I do not see the same error when rendering in rmarkdown::render.
Consider the following document (also at https://github.com/matthew-brett/quarto-test-book/blob/main/intro.Rmd):
```{r}
source('setup.R')
# Contains only the following function:
# get_var <- function(name) {
# return (get(name))
# }
```
```{r}
# Redefining the exact same function here fixes error below.
# get_var <- function(name) {
# return (get(name))
# }
```
```{r}
p <- 1
```
```{r}
# No error
get('p')
```
```{r}
# Error here:
# Error in get(name) : object 'p' not found
# Calls: .main ... withCallingHandlers -> withVisible -> eval -> eval -> get_var -> get
get_var('p')
```
See the noted error in the last chunk, generated by quarto render.
There is no error for Rscript -e "rmarkdown::render('intro.Rmd')", and I get the expected output ([1] 1).
Is there something different about the scope or environment when executing via Quarto?
I have run into a strange error rendering in Quarto that appears to be a scope problem. I do not see the same error when rendering in
rmarkdown::render.Consider the following document (also at https://github.com/matthew-brett/quarto-test-book/blob/main/intro.Rmd):
See the noted error in the last chunk, generated by
quarto render.There is no error for
Rscript -e "rmarkdown::render('intro.Rmd')", and I get the expected output ([1] 1).Is there something different about the scope or environment when executing via Quarto?