Put an upper limit on the value of variable in R
<p>How can I put an upper cap on the variable in R?</p>

<p>Suppose I have a data.frame with columns "a" and "b". Values of "b" range from 1:100. I want to make all values > 50 equal to 50.</p>

<p>I can write a loop and get this done, but I am in need of a function.</p>