title: How do I construct a simple function where all I need to provide is a variable
body: <p>I'm curious about why this works:</p>
  
  <pre><code>    fc &lt;- function(s, i){  
        s &lt;- data[i,]
        return(mean(s$V1, na.rm=T))
      }
      bootmean &lt;- boot(data, fc, R=500)
  </code></pre>
  
  <p>But this does not:</p>
  
  <pre><code>    fc &lt;- function(s, i, x){  
        s &lt;- data[i,]
        return(mean(s$x, na.rm=T))
      }
      bootmean &lt;- boot(data, fc, R=500, x=V1)
  </code></pre>
  
  <p>Where <code>V1</code> is a variable in a data frame. I'm basically trying to create a function where I only have to provide </p>
  
  <pre><code>    bootmean &lt;- boot(data, fc, R=500, x=V1)
  </code></pre>
  
  <p>and it performs the function on the variable I provide. </p>
  
  <p>Example <code>Data =</code></p>
  
  <pre><code>    ID      V1
      1       2
      2       6
      3       3
      4       2
      5       5
  </code></pre>