<span class="synComment"># ある変数のスコアで三等分する場合</span> quantile<span class="synSpecial">(</span>data$score<span class="synSpecial">,</span>probs=c<span class="synSpecial">(</span><span class="synConstant">0</span><span class="synSpecial">,</span><span class="synConstant">0.33</span><span class="synSpecial">,</span><span class="synConstant">0.66</span><span class="synSpecial">,</span><span class="synConstant">1</span><span class="synSpecial">))</span> <span class="synComment"># cut関数で分割。マイナス無限大(-Inf)からプラス無限大(Inf)をパーセンタイルでカット。1,2,3のラベルが付く。</span> data$class <span class="synStatement"><-</span> cut<span class="synSpecial">(</span>data<span class="synSpecial">,</span>breaks=c<span class="synSpecial">(</span>-Inf<span class="synSpecial">,</span>***<span class="synSpecial">,</span>****<span class="synSpecial">,</span>Inf<span class="synSpecial">),</span>right=<span class="synConstant">TRUE</span><span class="synSpecial">,</span>invlude.lowest=<span class="synConstant">TRUE</span><span class="synSpecial">)</span>