`xor` function in R
<p>I'm trying to work through the code in a bootstrap simulation on <a href="https://stats.stackexchange.com/a/193997/67822">this post</a> with two major hurdles. First, the few times I have played with bootstrapping, I have done it without using the <code>{boot}</code> package, and relying on functions like <code>replicate</code>, or simply loops. And second, and the main object of my question, I don't know what the function <code>xor</code> takes in as inputs, and what it ultimately does:</p>

<pre><code>n &lt;- 1000
dat &lt;- c("A", rep("B", n-1))
indicator &lt;- function(x, ndx)   xor("A"%in%x[ndx], TRUE) 
</code></pre>

<p>I see that it assesses whether <code>"A"</code> is in <code>x</code> and returns <code>FALSE</code> if it actually is in it. The issue comes with the input <code>ndx</code>. It probably stands for "index", and this is likely connected with the bootstrapping that follows:</p>

<pre><code>p_hat &lt;- function(dat, m=1e3){
    foo &lt;- boot(data=dat, statistic=indicator, R=m) 
    1/mean(foo$t)
} 

reps &lt;- replicate(100, p_hat(dat))
</code></pre>

<p>But how? What in this last chunk of code feeds the <code>ndx</code> in the first chunk?</p>