I am using the dlookr package in my project and cannot knit my RMarkdown file while the code for installing and loading the dlookr package is in the source. This is the error I am getting:
Quitting from lines 12-27 [setup] (Final-Project.Rmd)
Error:
! package or namespace load failed for 'dlookr':
.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(dlookr)
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"
The code in lines 12-27 is just different packages I am loading. Here is a screenshot of the code chunk: enter image description here
I tried solutions posted here and here. I checked my Global options and my mirror is already set to "Global (CDN) - RStudio", nothing in my secondary repositories section. Also, I tried the various commands suggested by R but still cannot seem to knit my file.
That looks like a bug in
kableExtra, which is being loaded becausedlookrimports it.kableExtra:::.onLoad()has this test:In your document,
rmarkdown::metadata$outputcontains more than one entry, sormarkdown::metadata$output %in% ...ends up containing more than one value.The workaround for this bug is simply to make sure the
outputsection in your YAML at the start of your document only contains one output format. For example, these would be fine:or
but this would trigger the error: