0

I submitted a package to CRAN that contains three functions. Each of these functions rely on console interaction to properly execute. I am having trouble with writing examples in the .Rd files because of the interactive nature of these functions. Specifically, menu() and readline(), both used heavily in my package, are giving me problems. When running devtools::check(), I get an error regarding the examples, stating "menu() cannot be used non-interactively."

I tried to take a shortcut by writing out directions to run each function as comments in the @examples field, e.g.

@examples #Run my_function()
#When prompted with 'Question?', type '2' and press Enter

This workaround was not accepted by CRAN. Any suggestions?

clc
  • 107
  • 6
  • First of all, your functions should check if they are called in interactive mode. If not, they should not call `menu` but return an error or do something else. Also, please don't submit to CRAN unless your package passes all checks (including on R-devel). – Roland Dec 16 '19 at 16:04
  • @Roland: I don't think I was clear in my question (which I have added upon). My package passes all of the checks, and my functions work properly. Because the functions are interactive, my examples in the .Rd files are not executable. I wrote the examples section of the .Rd files as comments as a workaround, but CRAN wants me to have actual examples – clc Dec 16 '19 at 17:37
  • Well, that's not what Writing R Extensions tells you to do. I believe you should use `\donttest` but I'd have to look at what other packages do if I was in your position. The only one I know off the top of my head is the HMR package and it uses `\dontrun`, but I know the package author doesn't necessarily follow best practice. – Roland Dec 17 '19 at 08:00

0 Answers0