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

R4.3 error if multiple files are passed to render_book without an output_format specified #1442

Closed
2 of 5 tasks
slodge-work opened this issue Oct 6, 2023 · 2 comments
Closed
2 of 5 tasks
Assignees
Labels
bug an unexpected problem or unintended behavior

Comments

@slodge-work
Copy link

This code is throwing an error in a bookdown project I'm porting to R4.3 and latest bookdown at current.

if (!is.null(fallback_index) &&

The error is:

Error in !is.null(fallback_index) && xfun::file_exists(fallback_index) : 
  'length = 9' in coercion to 'logical(1)'

I'm afraid I can't send a repro - as I'm not sure I understand how our bookdown project works at present! However, the error is caused I think by the fact that we are passing multiple Rmds into render_book but not passing in any output_format:

bookdown::render_book(list.files(here::here("build"), pattern = "\\.Rmd$"))

This causes a vector of 9 Rmd files to be in input - and this vector is then passes as the fallback_index parameter to get_output_formats here:

https://github.com/rstudio/bookdown/blob/3898705684ab831bc189e8d9c99e897f338e0454/R/render.R#L87C1-L91C8

This then gets into the if predicate inside get_output_formats. In previous versions of R, this caused a warning - but as of R4.3 this is now an error.


We obviously have an easy workaround here within our code - we can just add an output_format:

bookdown::render_book(list.files(here::here("build"), pattern = "\\.Rmd$"), output_format = "bookdown::html_book")

... but I thought this report might help the project and future users.

Checklist

When filing a bug report, please check the boxes below to confirm that you have provided us with the information we need. Have you:

  • formatted your issue so it is easier for us to read?

  • included a minimal, self-contained, and reproducible example?

  • pasted the output from xfun::session_info('bookdown') in your issue?

  • upgraded all your packages to their latest versions (including your versions of R, the RStudio IDE, and relevant R packages)?

  • installed and tested your bug with the development version of the bookdown package using remotes::install_github("rstudio/bookdown") ?

@slodge-work slodge-work changed the title R4.3 error if multiple files are passed to render_book without no output_format specified R4.3 error if multiple files are passed to render_book without an output_format specified Oct 6, 2023
@slodge-work slodge-work changed the title R4.3 error if multiple files are passed to render_book without an output_format specified R4.3 error if multiple files are passed to render_book without an output_format specified Oct 6, 2023
@yihui yihui added the bug an unexpected problem or unintended behavior label Oct 7, 2023
@yihui yihui moved this from Backlog to Todo In Progress in R Markdown Team Projects Oct 9, 2023
@yihui yihui self-assigned this Oct 9, 2023
@yihui
Copy link
Member

yihui commented Oct 9, 2023

Should be fixed now. Thanks for the report!

@yihui yihui closed this as completed in 1ffd96c Oct 9, 2023
@github-project-automation github-project-automation bot moved this from Todo In Progress to Done in R Markdown Team Projects Oct 9, 2023
Copy link

This old thread has been automatically locked. If you think you have found something related to this, please open a new issue by following the issue guide (https://yihui.org/issue/), and link to this old issue if necessary.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 10, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug an unexpected problem or unintended behavior
Projects
Archived in project
Development

No branches or pull requests

2 participants