Use case of setValues raster
<p>I recently stumbled upon the <code>setValues()</code>form the <code>raster</code> package, but I am wondering what the use case of this function is. Is  there any advantage compared to normal subsetting and indexing:</p>

<pre><code>r     &lt;- raster(ncol=10, nrow=10)

#setValues Function
r     &lt;- setValues(r, values=1, index=10)

#Normal indexing
r[10] &lt;- 1
</code></pre>

<p>Both ways yield in the same result. However the documentation states that:</p>

<blockquote>
  <p>While you can access the 'values' slot of the objects directly, you
  would do that at your own peril because when setting values, multiple
  slots need to be changed; which is what these functions do.</p>
</blockquote>

<p>What does the author mean by peril here? And what slots remain unchanged, when I use normal subsetting and not the setValues function or is there any advantage in terms of perfomance?</p>