title: R: How to avoid user input (or give the same input) in a loop
body: <p>I have a problem in one of my loops. Inside the loop, I am using a function that asks for user input in some cases. This function searches on a data base and when the object appears more than 1 time, it asks the user to choose among the multiple cases (function tax_rank() from the package taxize). </p>
  
  <p>The basics would be:</p>
  
  <pre><code>species &lt;- list("Ursus arctos", "Pica pica", "Cardamine nivalis")
  for(sp in species){
      rank.taxa &lt;- tax_rank(sp,db='gbif')
      if((is.na(rank.taxa))|rank.taxa!="species"){
       print("not a species")
      }else{
       print("species")
      }
  </code></pre>
  
  <p>If you try this, it should ask you for input in the case of Cardamine nivalis. </p>
  
  <p>I have a lot of cases, so I wanted to modify my loop so it can automatically answer this question (e.g. choosing always the first case) or avoid giving input and either return a NA or an error.</p>