title: R: How to create a loop for, for a range of data in a function?
body: <p>I have this parameter: </p>
  
  <pre><code>L_inf &lt;- seq(17,20,by=0.1)
  </code></pre>
  
  <p>and this function: </p>
  
  <pre><code>fun &lt;- function(x){
    L_inf*(1-exp(-B*(x-0)))}
  </code></pre>
  
  <p>I would to apply this function for a range of value of <code>L_inf</code>.
  I tried with loop <code>for</code>, like this: </p>
  
  <pre><code>A &lt;- matrix() # maybe 10 col and 31 row or vice versa
  for (i in L_inf){
  A[i] &lt;- fun(1:10)
  }
  </code></pre>
  
  <p>Bur R respond: <code>longer object length is not a multiple of shorter object length</code>. 
  My expected output is a matrix (or data frame, or list maybe) with 10 result (<code>fun(1:10)</code>) for each value of the vector <code>L_inf</code> (lenght=31).
  How can to do it?</p>