Skip to content

Set QUARTO_R to be sure to run with the same R version as the current R session ?  #204

Closed
@cderv

Description

@cderv
withr::with_envvar(
  list(QUARTO_R = fs::path(R.home(), "bin")), 
  withr::with_dir(temp_demo, quarto::quarto_render(as_job = FALSE))
)

I needed to do that because of this error

> withr::with_dir(temp_demo, quarto::quarto_render(as_job = FALSE))
[ 1/10] index.qmd
++ Activating rlang global_entrace



processing file: index.qmd
Error in `comment_chars[[engine]] %||% "#"`:
! could not find function "%||%"
Backtrace:
  1. global .main()
  2. execute(...)
  3. rmarkdown::render(...)
  4. knitr::knit(knit_input, knit_output, envir = envir, quiet = quiet)
  5. knitr:::process_file(text, output)
     ...
  8. knitr (local) FUN(X[[i]], ...)
  9. knitr:::parse_block(g[-1], g[1], params.src, markdown_mode)
 10. knitr::partition_chunk(engine, code)
 11. xfun::divide_chunk(engine, code)
 12. xfun:::get_option_comment(engine)
Execution halted

could not find function "%||%"

xfun 0.46 only defines "%||%" for R 4.4 which is the version I used to call quarto_render(). But probably quarto renderCLI is using the default R version in the PATH which is4.3`. Somehow xfun was not handling this correctly... 🤔

Setting QUARTO_R solves it

Need to understand why.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions