"incorrect number of probabilities" error using sample()
<p>I was trying sample(), however whenever I used custom probability in it ,it constantly displays "incorrect number of probabilities"</p>

<p>I've tried pretty much everything but still stuck. Kindly guide me as to what I am doing wrong..</p>

<p>Code:</p>

<pre><code>sample(10:50,4,replace = T,prob = c(.1,.2,.3,.4))   
</code></pre>

<blockquote>
  <p>Error in sample.int(length(x), size, replace, prob) :<br>
       incorrect number of probabilities</p>
</blockquote>