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

Errors in Bookdown after updating R 4.3.0 #750

Closed
selfaddicted opened this issue Apr 23, 2023 · 16 comments
Closed

Errors in Bookdown after updating R 4.3.0 #750

selfaddicted opened this issue Apr 23, 2023 · 16 comments

Comments

@selfaddicted
Copy link

Describe the bug
Failed to load the pkg in book down environment
the error message is as below

Error: package or namespace load failed for 'kableExtra':
.onLoad failed in loadNamespace() for 'kableExtra', details:
call: !is.null(rmarkdown::metadata$output) && rmarkdown::metadata$output %in%
error: 'length = 2' in coercion to 'logical(1)'

To Reproduce

  1. Create a bookdown project
  2. Call library(kableExtra) in a Rmd file
  3. Build the project

it's too simple to reproduce.
when I rolled back R to 4.2.3 and the error was gone.

kupietz added a commit to kupietz/kableExtra that referenced this issue Apr 25, 2023
kupietz added a commit to kupietz/kableExtra that referenced this issue Apr 25, 2023
Fixes R 4.3 compatibility and resolves haozhu233#750
@acebollada80
Copy link

I have the same problem.
I have updated to R 4.2.3 and uninstall and install the latest version of kableextra, with install.packages and with devtools and I had same message when I runned knit to word.

Any solution??

Thanks in advance

@oldiya
Copy link

oldiya commented Apr 26, 2023

Same issue here on R 4.3. Does downgrading to 4.2.3 help?

@oldiya
Copy link

oldiya commented Apr 26, 2023

I installed the patched version from @kupietz and it works, see his comment for more information

@acebollada80
Copy link

I have noticed several issues with the new version of R that caused conflicts for me.
Previously, I had the following line: 'options(OutDec = ",")' that I have removed.
In terms of the output format, I used to have the following header:

output:
pdf_document:
toc: yes
toc_depth: '6'
bookdown::pdf_document2:
toc: yes
toc_depth: '6'
word_document:
toc: yes
toc_depth: '6'
html_document:
toc: yes
toc_float: yes
toc_collapsed: yes
toc_depth: 6
number_sections: yes
theme: lumen

However, if I change it and leave only the following for the 'word_document' output format:

output:
word_document:
toc: yes
toc_depth: '6'
I was able to solve my conflicts with the new version of R. I hope this solution is helpful to other users who may be experiencing similar issues."

@acebollada80
Copy link

I installed the patched version from @kupietz and it works, see his comment for more information

Could I do this? How can I installed the patched version?
Thanks in advance

@oldiya
Copy link

oldiya commented Apr 26, 2023

In the comment, he suggested doing

devtools::install_github("kupietz/kableExtra")

This works for me.

@kjewell
Copy link

kjewell commented Apr 28, 2023

[update: restarting the rsession after installing the dev version also corrected this issue, see below.]

I got the same error knitting an existing .Rmd file to html after upgrading to 4.3.0

The dev version from @kupietz did not solve the problem, but deleting the following header lines from my file;

output:
  html_document: default
  pdf_document: default

avoided the error.

@kupietz
Copy link
Contributor

kupietz commented Apr 28, 2023

I got the same error knitting an existing .Rmd file to html after upgrading to 4.3.0

The dev version from @kupietz did not solve the problem, but deleting the following header lines from my file;

Can you tell me the error message you got and have you restarted your R session after installing kupietz/kableExtra?

@rhurlin
Copy link

rhurlin commented Apr 28, 2023

I don't think you really need to restart your R session. The following should do the trick:

detach(package:kableExtra)
library(kableExtra)

@kjewell
Copy link

kjewell commented Apr 28, 2023

My apologizes. I reinstalled the dev version and then restarted the r session and the error was avoided. i must not have restarted last time.

@kjewell
Copy link

kjewell commented May 3, 2023

Ok, ran into the same/similar issue again on another file, using the @kupietz dev version.

error:

Quitting from lines 8-10 (test_output.Rmd)
Error: package or namespace load failed for 'kableExtra':
.onLoad failed in loadNamespace() for 'kableExtra', details:
call: if (!is.null(rmarkdown::metadata$output) && names(rmarkdown::metadata$output)[1] %in%
error: missing value where TRUE/FALSE needed
Execution halted

Here, the difference seems to be that the output was defined using slightly different syntax:
output: html_document

To Reproduce
Create a markdown file with the following content:

---
 output: html_document
---
 
{r setup, include=FALSE}
library(kableExtra)
knit the file.

Deleting the
'output: html_document'
line resolves the issue.

@kupietz
Copy link
Contributor

kupietz commented May 3, 2023

Ok, ran into the same/similar issue again on another file, using the @kupietz dev version.

error:

Quitting from lines 8-10 (test_output.Rmd)
Error: package or namespace load failed for 'kableExtra':
.onLoad failed in loadNamespace() for 'kableExtra', details:
call: if (!is.null(rmarkdown::metadata$output) && names(rmarkdown::metadata$output)[1] %in%
error: missing value where TRUE/FALSE needed
Execution halted

Thanks for the report! I've fixed the problem in kupietz/kableExtra and in PR #751 via c50a4cc .

@felipejuan
Copy link

Once I installed the patch from @kupietz, I had an issue with the kable_styling function, where the function is not found in the patched version once I try to knit the file. I've tried deleting the file outputs and restarting sessions when I apply these changes.

@go4ino
Copy link

go4ino commented Aug 25, 2023

I have a similar issue in r 4.3.1 when trying to knit a pdf / html / word document.

When I knit the document and leave out library(kableExtra), it renders just fine.

Does the switching to the dev version of the library fix this?

processing file: doc1.Rmd
                                                                                                            

Quitting from lines 37-138 [setup] (doc1.Rmd)
Error:
! package or namespace load failed for 'kableExtra':
 .onLoad failed in loadNamespace() for 'kableExtra', details:
  call: !is.null(rmarkdown::metadata$output) && rmarkdown::metadata$output %in% 
  error: 'length = 2' in coercion to 'logical(1)'
Backtrace:
 1. base::library(kableExtra)
 2. base::tryCatch(...)
 3. base (local) tryCatchList(expr, classes, parentenv, handlers)
 4. base (local) tryCatchOne(expr, names, parentenv, handlers[[1L]])
 5. value[[3L]](cond)
Execution halted

@raffaem
Copy link

raffaem commented Sep 20, 2023

@kupietz Thanks, that worked!
@haozhu233 Is this still maintained?

@bshor
Copy link

bshor commented Dec 12, 2023

I am using Fedora COPR R archive. I have to install the Github version because the COPR version is still 1.3.4.

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

Successfully merging a pull request may close this issue.

10 participants