Hello,
I have a function that is used to generate LaTeX code for reporting. When
doing R CMD check, I get an error that the "\\ldots" argument does not match
between the code and documentation. I think that the error is coming from
the Codoc check in R CMD check not escaping the backslash before ldots. Is
my diagnosis correct? If so, what is the best way to report this as a bug
in R CMD check?
The R CMD check warning:
Warning: Codoc mismatches from documentation object
'topic_long_table_header':
topic_long_table_header
Code: function(x, col_names = NULL, above_col_names = "\\hline",
below_col_names = "\\hline",
subsequent_page_notification = "\\ldots continued",
latex_header = NULL, verbatim = NULL)
Docs: function(x, col_names = NULL, above_col_names = "\\hline",
below_col_names = "\\hline",
subsequent_page_notification = "\... continued",
latex_header = NULL, verbatim = NULL)
Mismatches in argument default values:
Name: 'subsequent_page_notification' Code: "\\ldots continued" Docs:
"\... continued"
The function looks like:
topic_long_table_header <- function(x,
col_names=NULL,
above_col_names="\\hline",
below_col_names="\\hline",
subsequent_page_notification="\\ldots
continued",
latex_header=NULL,
verbatim=NULL) {
# do stuff here
}
The .Rd file (generated by roxygen2) looks like:
topic_long_table_header(
x,
col_names = NULL,
above_col_names = "\\\\hline",
below_col_names = "\\\\hline",
subsequent_page_notification = "\\\\ldots continued",
latex_header = NULL,
verbatim = NULL
)
If looking in more detail would help, relevant parts of the GitHub repo are:
https://github.com/billdenney/TopicLongTableR/blob/main/R/topic_long_table_h
eader_footer.R
https://github.com/billdenney/TopicLongTableR/blob/main/man/topic_long_table
_header.Rd
https://github.com/billdenney/TopicLongTableR/actions/runs/5771551599/job/15
645624146#step:6:99
Thanks,
Bill
[R-pkg-devel] Possible bug in Codoc checking with R CMD Check
2 messages · biii m@iii@g oii de@@ey@ws, Ivan Krylov
? Sat, 5 Aug 2023 12:26:20 -0400 <bill at denney.ws> ?????:
I think that the error is coming from the Codoc check in R CMD check not escaping the backslash before ldots. Is my diagnosis correct? If so, what is the best way to report this as a bug in R CMD check?
Mismatches in argument default values:
Name: 'subsequent_page_notification' Code: "\\ldots continued"
Docs: "\... continued"
I think you're right. You can see the code doing the string substitution in tools:::.parse_usage_as_much_as_possible. Unfortunately, expressing "replace \whatever but only if the backslash is not escaped" using regular expressions is hard; for example, \\\whatever ought to be interpreted as an escaped backslash followed by a non-escaped \whatever, and so on. A negative look-behind assertion wouldn't do the right thing in this case. Send an e-mail to R-devel at r-project.org to discuss a potential solution, but be ready to file a problem report on R Bugzilla in order to make sure that it's not forgotten (which takes more steps but may be "more right"). See https://r-project.org/bugs.html for the official instructions. Meanwhile, I can suggest omitting the "\\ldots continued" default value from the Rd file as a workaround. WRE is not explicit about this, but missing default argument values currently don't count against you during a codoc() check, which is useful if the actual expression used to compute the default value is unwieldy.
Best regards, Ivan