title: The condition has length > 1 and only the first element will be used. What changes to make?
body: <p>When i run the below function, i get the output for just one value.
  with a message,
  "the condition has length > 1 and only the first element will be used"</p>
  
  <p>What changes do i need to make to get all values?</p>
  
  <pre><code>ownsquare &lt;- function(n)
  {
    for (i in seq(from = 1, to = 506, by = 0.001))
    {
      r &lt;- i * i
      if (r &lt;= n) x=i
    }
   x 
  }
  </code></pre>