Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

set_collapse with mask=all and quarto/knitr fail #647

Open
DMozzanica opened this issue Oct 24, 2024 · 1 comment
Open

set_collapse with mask=all and quarto/knitr fail #647

DMozzanica opened this issue Oct 24, 2024 · 1 comment

Comments

@DMozzanica
Copy link

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:

  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)
    ...
  6. FUN(X[[i]], ...)
  7. knitr:::sew.source(x, options, ...)
  8. (knit_hooks$get("source"))(src, options)
  9. create_fence(x, "`")
  10. 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

@SebKrantz
Copy link
Owner

SebKrantz commented Oct 24, 2024

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...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants