How to run Quarto .qmd from within package

I'm trying to write an article in Quarto/rmarkdown from within a package. The package will include functions and data pertaining to the article. The package documentation is being generated with pkgdown. I would like to include a function within the package that produces/runs/views the index.qmd. I've created a github repository with the code.

The operative function as currently written is :

viewArticle <- function(){
    quarto::quarto_run(input = system.file("article", "index.qmd", package = "helloQuarto"))

Here are the commands for starting with a clean project on my local machine:

search() #check path

Upon running the above commands, I receive the following error:

ERROR: The specified directory ('.') is not a Quarto project
Error in `processx::run(quarto_bin, args, echo = TRUE)`:
! System command 'quarto' failed
Exit status: 1
stdout & stderr: <printed>
Type .Last.error to see the more details.
Error in `processx::run(quarto_bin, args, echo = TRUE)`:
! System command 'quarto' failed
Exit status: 1
stdout & stderr: <printed>
1. helloQuarto::viewArticle()
2. quarto::quarto_run(input = system.file("article", "index.qmd", …
3. quarto::quarto_render(input)
4. processx::run(quarto_bin, args, echo = TRUE)
5. processx:::throw(new_process_error(res, call =, echo = echo, …

Session info is as follows:

R version 4.1.3 (2022-03-10)
Platform: x86_64-apple-darwin17.0 (64-bit)
Running under: macOS Monterey 12.5.1

Matrix products: default
LAPACK: /Library/Frameworks/R.framework/Versions/4.1/Resources/lib/libRlapack.dylib

[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8

attached base packages:
[1] stats     graphics  grDevices datasets  utils     methods   base     

other attached packages:
[1] helloQuarto_0.1.0

Helpful resources include ?knitr::knit() @ note on paths and Quarto projects page.

Any help would be greatly appreciated.


This function will require the user that use it to have Quarto available on PATH. Warning: CRAN won't have quarto (in case you plan to publish it to CRAN)

This is what the issue you have is about

Do you really need index.qmd to be run by the user ? Can't you just share as a HTML file ?

In R package, especially for CRAN, vignettes with rmarkdown engine is still the best way to that. Quarto is not available for vignette on CRAN yet.

Building for a pkgdown website though to be publish as HTML is maybe possible though, as pkgdown process is independant of CRAN

Good comments and good questions. I did not understand the error message so your response saves me from spending days debugging the code.

Many thanks. I had some ideas on a workaround and I'll pursue those instead.


1 Like

This topic was automatically closed 45 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.