title: Why can I pass a vector to some functions and not others?
body: <p>Can someone explain why this fails when the function is Vectorized? I thought Vectorization was just pre-allocation of memory. If I pass a vectorized parameter to <code>outer</code> it works fine, why cant I pass one to any function in general?</p>
  
  <p>This works:</p>
  
  <pre><code>Fun &lt;- function(a,b) sum(a+b)
  VecFun &lt;- Vectorize( Fun )
  outer(1:3,1:3,VecFun)   #works perfectly, by which I mean it runs and returns a result
  </code></pre>
  
  <p>This doesnt:</p>
  
  <pre><code>a.trial&lt;-function(){sample(c(0,0,0,1),1,replace=T)} 
  
  a.trial.vectorized&lt;-Vectorize(a.trial)
  
  a.distrib&lt;-replicate(a.trial.vectorized,10000) #has error when runs why, it follows the same pattern as the working example above
  #a.distrib&lt;-replicate(a.trial(),10000)   #works without error
  </code></pre>