set_collapse with mask=all and quarto/knitr fail
I don’t know if the issue is on the collapse side or on the Quarto side…
Executing a Quarto document with set_collapse(nthreads = 4, mask = "all") fails with the following error:
Processing file: prova.txt
|.......................................... | 80% [unnamed-chunk-2]Error in names<-:
! tentativo di impostare un attributo a NULL
Backtrace:
- global .main()
- execute(...)
- rmarkdown::render(...)
- knitr::knit(knit_input, knit_output, envir = envir, quiet = quiet)
- knitr:::process_file(text, output) ...
- FUN(X[[i]], ...)
- knitr:::sew.source(x, options, ...)
- (knit_hooks$get("source"))(src, options)
- create_fence(x, "`")
- collapse::fmax.default(...)
Quitting from lines 14-15 [unnamed-chunk-2] (prova.qmd)
Attached you can find the file.
Best regards, Domenico Mozzanica prova.txt
Thanks. In general set_collapse(mask = "all") is risky because it replaces basic functions like max() with fmax(), which is S3 generic. For example max(matrix) gives a number, but fmax(matrix) gives a vector. Usually internal package code is not affected by this, but knitr may be an exeption. Ostensibly, some internal knitr functions were affected by this. Thus, use less comprehensive masking when using knitr/Rmarkdown/quarto.
And indeed this may be interesting to flag to them...