Repository navigation
Description
This is the result of an investigation with @DavisVaughan following a CRAN check error with tibbletime https://cran.r-project.org/web/checks/check_results_tibbletime.html and 12 more packages
CRAN email is :
CRAN packages with unused arguments error
That is
DriveML SmartEDA anomalize bayestestR broom effectsize heemod
isoreader mlrCPO panelr parameters tibbletime
These show very similar errors in vignette re-building on Solaris and
macOS (which do not have pandoc so test your package without): you may
wish to discuss this with the knitr maintainer.
We manage to reproduce the error using
library(rmarkdown)
knitr::opts_chunk$set(error = FALSE)
knitr::knit("vignettes/TT-01-time-based-filtering.Rmd")which has this traceback
traceback
> traceback()
21: print.tbl_time(x, ...)
20: print(x, ...)
19: knit_print.data.frame(x, ...)
18: knit_print(x, ...)
17: withVisible(knit_print(x, ...))
16: fun(x, options = options)
15: value_fun(ev$value, ev$visible)
14: withVisible(value_fun(ev$value, ev$visible))
13: withCallingHandlers(withVisible(value_fun(ev$value, ev$visible)),
warning = wHandler, error = eHandler, message = mHandler)
12: handle(pv <- withCallingHandlers(withVisible(value_fun(ev$value,
ev$visible)), warning = wHandler, error = eHandler, message = mHandler))
11: evaluate_call(expr, parsed$src[[i]], envir = envir, enclos = enclos,
debug = debug, last = i == length(out), use_try = stop_on_error !=
2L, keep_warning = keep_warning, keep_message = keep_message,
output_handler = output_handler, include_timing = include_timing)
10: evaluate::evaluate(...)
9: evaluate(code, envir = env, new_device = FALSE, keep_warning = !isFALSE(options$warning),
keep_message = !isFALSE(options$message), stop_on_error = if (options$error &&
options$include) 0L else 2L, output_handler = knit_handlers(options$render,
options))
8: in_dir(input_dir(), evaluate(code, envir = env, new_device = FALSE,
keep_warning = !isFALSE(options$warning), keep_message = !isFALSE(options$message),
stop_on_error = if (options$error && options$include) 0L else 2L,
output_handler = knit_handlers(options$render, options)))
7: block_exec(params)
6: call_block(x)
5: process_group.block(group)
4: process_group(group)
3: withCallingHandlers(if (tangle) process_tangle(group) else process_group(group),
error = function(e) {
setwd(wd)
cat(res, sep = "\n", file = output %n% "")
message("Quitting from lines ", paste(current_lines(i),
collapse = "-"), " (", knit_concord$get("infile"),
") ")
})
2: process_file(text, output)
1: knitr::knit("vignettes/TT-01-time-based-filtering.Rmd")Without loading rmarkdown first, there is no error.
We believe this happens because rmarkdown:::knit_print.data.frame is called and pass ... to print()
Lines 1 to 32 in 1707d0b
| knit_print.data.frame <- function(x, ...) { | |
| context <- render_context() | |
| # printing of certain expressions producing | |
| # 'data.table' objects should be suppressed | |
| printable <- TRUE | |
| if ("data.table" %in% loadedNamespaces() && | |
| exists("shouldPrint", envir = asNamespace("data.table"))) | |
| { | |
| shouldPrint <- get("shouldPrint", envir = asNamespace("data.table")) | |
| printable <- tryCatch( | |
| shouldPrint(x) || !inherits(x, "data.table"), | |
| error = function(e) TRUE | |
| ) | |
| } | |
| if (!printable) | |
| return(invisible(NULL)) | |
| if (!is.null(context$df_print)) { | |
| if (identical(context$df_print, knitr::kable)) { | |
| res <- c('', knitr::kable(x), '') | |
| if (knitr::is_html_output()) | |
| res <- c('<div class="kable-table">', res, '</div>') | |
| knitr::asis_output(one_string(res)) | |
| } else { | |
| context$df_print(x) | |
| } | |
| } else { | |
| print(x, ...) | |
| } | |
| } |
These ... contains knit_print arguments inline and options
This will then trigger print.tbl_time passing those two arguments that throws the unused arguments error.
This error was hidden for now because it only happens if rmarkdown is loaded and we think it is now because of yihui/knitr@fb2f427#diff-d0d9f9e52333dc5483c4882b0923ed3e0d31de7534bb8601d3b992998698abc5
- Before pandoc-citeproc was check, and was not there so FALSE was return with
rmarkdown::pandoc_availablebeing called. Nowknitr::pandoc_availablewill load rmarkdown and the method will be registered.
One fix would be to not pass ... to print from knit_print so that inline and options are not passed to unknown print method that don't know about these arguments.
Unless I missed something and this is expected.
@yihui pinging you as this cause some CRAN check failure for others packages.
Activity
DavisVaughan commentedon Feb 16, 2021
I took a quick look at a few of the failing CRAN packages to see where we were passing the
...down to. Most of the cases passed the...down to a function that eventually didn't have..., andoptionswasn't one of the named arguments that it did have, so the error was thrown.Maybe it is the responsibility of
tibbletime:::print.tbl_time()to capture the...and only pass down the dots that correspond to named arguments intibble::trunc_mat(). That would be one way to fix this.However, I do agree that
print()when called from the data frame method ofknit_print()should probably not be getting theoptionsandinlinearguments. Fixing that would probably immediately fix all of the failing packages, and feels like the right thing to do. After that the individual package authors can make their print methods more robust to this.cderv commentedon Feb 16, 2021
BTW, it does not error when using
rmarkdown::renderbecausehtml_documentsetscontext$df_printwhich default toprintbut in this case, the...are not passed, hence no error in the other packages.rmarkdown/R/knit_print.R
Line 27 in 1707d0b
So this make the case to not pass
...toprint- it does not seem to be required.cderv commentedon Feb 18, 2021
For more context, the packages that could be impacted by this issue and have CRAN check failure based on the emails received are
It seems there are 2 false positives but the others have indeed the same errors related to :
"Error: processing vignette")options =being passed and unused ("unused argument (options")Created on 2021-02-18 by the reprex package (v1.0.0)
Fix for knit_print.data.frame (#2050)
DavisVaughan commentedon Feb 18, 2021
broom was a false positive, i have been told it was meant to be broom.helpers https://cran.r-project.org/web/checks/check_results_broom.helpers.html
cderv commentedon Feb 19, 2021
Oh yes I forgot you mentioned that. It is indeed:
Created on 2021-02-19 by the reprex package (v1.0.0)
The email was sent to them too. Thanks!
cderv commentedon Feb 23, 2021
There are still issues on macOS but it is mainly because the 2.7 binary is not yet build
Created on 2021-02-23 by the reprex package (v1.0.0.9001)
github-actions commentedon Aug 24, 2021
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.