title: menu() cannot be used non-interactively in R
body: <p>While testing a function when I use <code>devtools::check()</code> to build and check the package it throws an error <code>Error: menu() cannot be used non-interactively</code></p>
  <p>Below is a small example code.</p>
  <pre><code>yes &lt;- c(&quot;Yes&quot;, &quot;Definitely&quot;, &quot;Positive&quot;, &quot;For sure&quot;, &quot;Yup&quot;, &quot;Yeah&quot;,
           &quot;Absolutely&quot;)
  no &lt;- c(&quot;Not sure&quot;, &quot;Not now&quot;, &quot;Negative&quot;, &quot;No&quot;, &quot;Nope&quot;, &quot;Absolutely not&quot;)
  
  ask_confirmation &lt;- function(title = NULL, positive = yes, negative = no) {
      options &lt;- c(sample(positive, 1), sample(negative, 2)) # Mix which ones
      options &lt;- sample(options, 3) # Random order
      sel &lt;- menu(options, title = title)
      invisible(c(&quot;Cancel&quot;, options)[sel + 1])
  }
  </code></pre>
  <p>How to overcome this problem? Any help would be greatly appreciated.</p>