title: Writing a function to calculate divisors in R
body: <p>I am trying to write a simple function in R to calculate all divisors of a number. 
  That is how I want to have my output:</p>
  
  <pre><code>&gt; divisors(21)
  [1] 1 3 7 21
  </code></pre>
  
  <p>I am a beginner and started with the code below. However I think it is completely wrong since it does not work at all. </p>
  
  <pre><code>divisors &lt;- function(number) {
    x &lt;- c(1:number)
    for(i in 1:number){
      if(number/i == c(x)) {
        paste(i)
      }
    }
    return(i)
  }
  divisors(10)
  </code></pre>