I'm not certain this will give you enough debug information, but you can run R CMD build in the current session using the internal function tools::.build_packages, e.g.

  R CMD build --no-manual testpkg

would be run as

  tools:::.build_packages(c("--no-manual", "testpkg"))

This removes one level of processes, but the tryCatch() and processes run within this function are still there, so it might not be sufficient for you. In that case the only solution might be to add debugging code into R and recompile it.

The similar command for INSTALL is tools:::.install_packages.

Duncan Murdoch

On 12/08/2021 11:06 p.m., Pavel N. Krivitsky wrote:
Dear All,

TL;DR: Is there a way to get a full traceback and/or frame dump for
errors that occur in build-time and install-time \Sexpr{} calls in R
documentation files?


# Context

I am working on a package (
https://github.com/joycecheng/ergm/tree/ergm-term-index ) whose
documentation includes a number of \Sexpr[stage=render]{} calls, and I
am getting reports that some Windows users are not able to install the
package because they get errors when the HTML indices are being built.

Complicating the matter is that this only seems to affect some Windows
systems but not others.

Unfortunately, R's output is not very helpful in identifying the
problem beyond the help file in which it had occurred and the terminal
error message. For example, on those systems with R 4.1.0:

remotes::install_github("joycecheng/ergm@ergm-term-index")

gives (for those users):

[SNIP]
ergmConstraint html
Error: incorrect number of dimensions
- removing
'C:/Users/[SNIP]/AppData/Local/Temp/RtmpURZYMP/Rinst1144e5a2698/ergm'
-----------------------------------
ERROR: package installation failed
Error: Failed to install 'ergm' from GitHub:
System command 'Rcmd.exe' failed, exit status: 1, stdout + stderr (last
10 lines):
E> ergm.exact html
E> ergm.geodistdist html
E> ergm.getnetwork html
E> ergm.godfather html
E> ergm.mple html
E> ergmConstraint html
E> Error: incorrect number of dimensions
E> * removing
'C:/Users/[SNIP]/AppData/Local/Temp/RtmpURZYMP/Rinst1144e5a2698/ergm'
E> -----------------------------------
E> ERROR: package installation failed


# What I've tried so far

  * Running the code in the \Sexpr{} manually in an R session doesn't
    reproduce the error: this seems to be a build/install-time issue.
  * options(error=...) does the wrong thing, because the \Sexpr{} code
    is run inside tryCatch(), so what gets traced and/or dumped is
    catching code, not the original error.

Thanks in advance,
Pavel

______________________________________________
R-package-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-package-devel


______________________________________________
R-package-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-package-devel

Reply via email to