rdevtoolsroxygen2

Getting more detailed diagnostic information from rlang after an error with devtools


I'm trying to develop my first R package. I'm trying to run the

devtools::build_manual()

function to build a PDF of the documentation. I get an error:

Error in `value[[3L]]()`:
! Failed to build manual
Run `rlang::last_error()` to see where the error occurred.

So then I run this and get

<error/rlang_error>
Error in `value[[3L]]()`:
! Failed to build manual
---
Backtrace:
    ▆
 1. └─devtools::build_manual()
 2.   └─base::tryCatch(...)
 3.     └─base (local) tryCatchList(expr, classes, parentenv, handlers)
 4.       └─base (local) tryCatchOne(expr, names, parentenv, handlers[[1L]])
 5.         └─value[[3L]](cond)
 6.           └─cli::cli_abort("Failed to build manual")
 7.             └─rlang::abort(...)

But I don't see how this contains any useful information to what's actually gone wrong. How can I dig deeper into this?

I've tried to run the devtools::check_man() function and I get

ℹ Updating test_package documentation
ℹ Loading test_package 
ℹ Checking documentation...
plot:
  function(x, ...)
plot.test_package_cv:
  function(model, num, ...)

print:
  function(x, ...)
print.test_package:
  function(model, num, ...)

predict:
  function(object, ...)
predict.test_package:
  function(model, X, ...)

I've tried to remove the plot, print, and predict functions but the build_manual() function still doesn't work, so I don't think the error lies there.


Solution

  • As I cannot see the current state of your package, I would suggest to run the following commands to make sure that your package is ready to have a manual. Also, please verify that the Roxygen documentation of your functions is well written (see section 17.1 roxygen2 basics of R Packages (2e) written by Hadley Wickham and Jennifer Bryan).

    library(devtools)
    pkgload::load_all()
    styler::style_pkg()
    usethis::use_mit_license()
    devtools::document()
    devtools::check()
    devtools::install()
    devtools::build_manual()