<html>
  <head>
    <meta content="text/html; charset=ISO-8859-1"
      http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    <div>Porque em vez de usar esse tipo escada de classificação você
      não usa um tipo suave? Para mim, este último faz mais sentido.
      Veja exemplo de como obter isso com a sua 'escada':<br>
      <br>
      ### Tabela da quinta aproximação <br>
      ###     Nível de Fósforo mg/dm3<br>
      ###Argila%    muito baixo         Baixo    Médio    Bom    Muito
      Bom<br>
      ###60-100    <2.7(menor e igual)    2.8-5.4    5.5-8   
      8.1-12    >12<br>
      ###35-60    <4                    4.1-8    8.1-12    12.1-18   
      >18<br>
      ###15-35    <6.6                    6.7-12    12.1-20   
      20.1-30    >30<br>
      ### 0-15    <10                    10.1-20    20.1-30   
      30.1-45    >45<br>
      <br>
      escada <- function(x, y, x.br, y.br, ...) { <br>
        ix <- findInterval(x, x.br, ...)+1<br>
        lr <- lapply(1:nrow(y.br), function(j) {<br>
          i <- which(ix==j)<br>
          list(i=i, r=findInterval(y[i], y.br[j,], ...)+1)<br>
        })<br>
        i <- sort(unlist(lapply(lr, function(x) x$i)), <br>
                  index.return=TRUE, method='quick')$ix<br>
        unlist(lapply(lr, function(x) x$r))[i]<br>
      }<br>
      <br>
      ### exemplo simulado<br>
      n <- 30000<br>
      x <- 90*runif(n)<br>
      y <- runif(n, 0, 100-x)*.7<br>
      <br>
      cfosf <- rbind(c(10, 20, 30, 45), c(6.6, 12, 20, 30),<br>
                     c(4, 8, 12, 18), c(2.7, 5.4, 8, 12))<br>
      cfosf<br>
      res <- escada(x, y, c(15, 35, 60), cfosf)<br>
      table(res)<br>
      <br>
      plot(x, y, col=res, pch=19, las=1, asp=1, cex=0.3, <br>
           xlab="Argila", ylab="Fósforo")<br>
      abline(v=c(15, 35, 60), col=gray(.7))<br>
      for (j in 1:nrow(cfosf))<br>
        segments(c(0, 15, 35, 60)[j], cfosf[j,],<br>
                 c(15, 35, 60, 100)[j], cfosf[j,], lty=3)<br>
      legend("topright", c("Muito baixo", "Baixo", "Médio", "Muito
      bom"),<br>
             pch=19, col=1:5, bty='n', title='Textura')<br>
      segments(0,100,100,0, lty=3)<br>
      <br>
      ### usando esses dados simulados<br>
      ### (ideal e' usar dados reais)<br>
      ### para obter uma funcao suave <br>
      <br>
      require(MASS)<br>
      aj <- polr(resp ~ x*y, data.frame(resp=factor(res,
      ordered=TRUE)))<br>
      <br>
      prd <- predict(aj)<br>
      <br>
      plot(x, y, col=unclass(prd), pch=19, las=1, asp=1, cex=0.3, <br>
           xlab="Argila", ylab="Fósforo")<br>
      legend("topright", c("Muito baixo", "Baixo", "Médio", "Muito
      bom"),<br>
             pch=19, col=1:5, bty='n', title='Textura')<br>
      <br>
      ### classificando um novo solo (Argila=36, fosforo=19)<br>
      ### usando a escada:<br>
      escada(36, 19, c(15, 35, 60), cfosf)<br>
      ### suave:<br>
      predict(aj, newdata=data.frame(x=36, y=19)) <br>
      <br>
      <br>
      Att.<br>
      Elias.<br>
       <br>
    </div>
    <blockquote
      cite="mid:5197e8bf836ed_122c283046c2ef@a4-winter11.tmail"
      type="cite">
      <hr style="border-top: 1px solid #ccc;">
      <div>Em 18/05/2013 09:28, <strong>Hélio Gallo Rocha <
          <a class="moz-txt-link-abbreviated" href="mailto:heliogallorocha@gmail.com">heliogallorocha@gmail.com</a> ></strong> escreveu:</div>
      <div dir="ltr">Bom dia a todos,
        <div> </div>
        <div>Para recomendar adubação fosfatada é necessário classificar
          a quantidade de fósforo da análise em conjunto a textura do
          solo.</div>
        <div> </div>
        <div>
          <table style="border-collapse: collapse; width: 311pt;"
            border="0" cellpadding="0" cellspacing="0" width="412">
            <colgroup><col style="width: 48pt;" width="64"> <col
                style="width: 96pt;" width="128"> <col style="width:
                38pt;" span="3" width="50"> <col style="width: 53pt;"
                width="70"> </colgroup>
            <tbody>
              <tr style="height: 12.75pt;">
                <td style="height: 12.75pt; width: 48pt;" height="17"
                  width="64"> Tabela da quinta aproximação 
                  <table style="width: 311pt; margin-left: 3pt;
                    border-collapse: collapse;" border="0"
                    cellpadding="0" cellspacing="0" width="415">
                    <tbody>
                      <tr style="height: 12.75pt;">
                        <td style="width: 48pt; border: 1pt solid
                          windowtext; padding: 0cm 3.5pt; height:
                          12.75pt;" nowrap="nowrap" valign="bottom"
                          width="64">
                          <p><span style="font-size: 10pt; font-family:
                              Arial;"> </span></p>
                        </td>
                        <td style="width: 263pt; border-style: solid
                          solid solid none; border-top-color:
                          windowtext; border-right-color: windowtext;
                          border-bottom-color: windowtext;
                          border-top-width: 1pt; border-right-width:
                          1pt; border-bottom-width: 1pt; padding: 0cm
                          3.5pt; height: 12.75pt;" colspan="5"
                          nowrap="nowrap" valign="bottom" width="351">
                          <p style="text-align: center;" align="center"><span
                              style="font-size: 10pt; font-family:
                              Arial;">Nível de Fósforo mg/dm3</span></p>
                        </td>
                      </tr>
                      <tr style="height: 12.75pt;">
                        <td style="width: 48pt; border-style: none solid
                          solid; border-right-color: windowtext;
                          border-bottom-color: windowtext;
                          border-left-color: windowtext;
                          border-right-width: 1pt; border-bottom-width:
                          1pt; border-left-width: 1pt; padding: 0cm
                          3.5pt; height: 12.75pt;" nowrap="nowrap"
                          valign="bottom" width="64">
                          <p><span style="font-size: 10pt; font-family:
                              Arial;">Argila%</span></p>
                        </td>
                        <td style="width: 97.7pt; border-style: none
                          solid solid none; border-bottom-color:
                          windowtext; border-bottom-width: 1pt;
                          border-right-color: windowtext;
                          border-right-width: 1pt; padding: 0cm 3.5pt;
                          height: 12.75pt;" nowrap="nowrap"
                          valign="bottom" width="130">
                          <p><span style="font-size: 10pt; font-family:
                              Arial;">muito baixo</span></p>
                        </td>
                        <td style="width: 37.6pt; border-style: none
                          solid solid none; border-bottom-color:
                          windowtext; border-bottom-width: 1pt;
                          border-right-color: windowtext;
                          border-right-width: 1pt; padding: 0cm 3.5pt;
                          height: 12.75pt;" nowrap="nowrap"
                          valign="bottom" width="50">
                          <p><span style="font-size: 10pt; font-family:
                              Arial;">Baixo</span></p>
                        </td>
                        <td style="width: 37.6pt; border-style: none
                          solid solid none; border-bottom-color:
                          windowtext; border-bottom-width: 1pt;
                          border-right-color: windowtext;
                          border-right-width: 1pt; padding: 0cm 3.5pt;
                          height: 12.75pt;" nowrap="nowrap"
                          valign="bottom" width="50">
                          <p><span style="font-size: 10pt; font-family:
                              Arial;">Médio</span></p>
                        </td>
                        <td style="width: 37.6pt; border-style: none
                          solid solid none; border-bottom-color:
                          windowtext; border-bottom-width: 1pt;
                          border-right-color: windowtext;
                          border-right-width: 1pt; padding: 0cm 3.5pt;
                          height: 12.75pt;" nowrap="nowrap"
                          valign="bottom" width="50">
                          <p><span style="font-size: 10pt; font-family:
                              Arial;">Bom</span></p>
                        </td>
                        <td style="width: 52.5pt; border-style: none
                          solid solid none; border-bottom-color:
                          windowtext; border-bottom-width: 1pt;
                          border-right-color: windowtext;
                          border-right-width: 1pt; padding: 0cm 3.5pt;
                          height: 12.75pt;" nowrap="nowrap"
                          valign="bottom" width="70">
                          <p><span style="font-size: 10pt; font-family:
                              Arial;">Muito Bom</span></p>
                        </td>
                      </tr>
                      <tr style="height: 12.75pt;">
                        <td style="width: 48pt; border-style: none solid
                          solid; border-right-color: windowtext;
                          border-bottom-color: windowtext;
                          border-left-color: windowtext;
                          border-right-width: 1pt; border-bottom-width:
                          1pt; border-left-width: 1pt; padding: 0cm
                          3.5pt; height: 12.75pt;" nowrap="nowrap"
                          valign="bottom" width="64">
                          <p><span style="font-size: 10pt; font-family:
                              Arial;">60-100</span></p>
                        </td>
                        <td style="width: 97.7pt; border-style: none
                          solid solid none; border-bottom-color:
                          windowtext; border-bottom-width: 1pt;
                          border-right-color: windowtext;
                          border-right-width: 1pt; padding: 0cm 3.5pt;
                          height: 12.75pt;" nowrap="nowrap"
                          valign="bottom" width="130">
                          <p><span style="font-size: 10pt; font-family:
                              Arial;"><2.7 (menor e igual)</span></p>
                        </td>
                        <td style="width: 37.6pt; border-style: none
                          solid solid none; border-bottom-color:
                          windowtext; border-bottom-width: 1pt;
                          border-right-color: windowtext;
                          border-right-width: 1pt; padding: 0cm 3.5pt;
                          height: 12.75pt;" nowrap="nowrap"
                          valign="bottom" width="50">
                          <p><span style="font-size: 10pt; font-family:
                              Arial;">2.8-5.4</span></p>
                        </td>
                        <td style="width: 37.6pt; border-style: none
                          solid solid none; border-bottom-color:
                          windowtext; border-bottom-width: 1pt;
                          border-right-color: windowtext;
                          border-right-width: 1pt; padding: 0cm 3.5pt;
                          height: 12.75pt;" nowrap="nowrap"
                          valign="bottom" width="50">
                          <p><span style="font-size: 10pt; font-family:
                              Arial;">5.5-8</span></p>
                        </td>
                        <td style="width: 37.6pt; border-style: none
                          solid solid none; border-bottom-color:
                          windowtext; border-bottom-width: 1pt;
                          border-right-color: windowtext;
                          border-right-width: 1pt; padding: 0cm 3.5pt;
                          height: 12.75pt;" nowrap="nowrap"
                          valign="bottom" width="50">
                          <p><span style="font-size: 10pt; font-family:
                              Arial;">8.1-12</span></p>
                        </td>
                        <td style="width: 52.5pt; border-style: none
                          solid solid none; border-bottom-color:
                          windowtext; border-bottom-width: 1pt;
                          border-right-color: windowtext;
                          border-right-width: 1pt; padding: 0cm 3.5pt;
                          height: 12.75pt;" nowrap="nowrap"
                          valign="bottom" width="70">
                          <p><span style="font-size: 10pt; font-family:
                              Arial;">>12</span></p>
                        </td>
                      </tr>
                      <tr style="height: 12.75pt;">
                        <td style="width: 48pt; border-style: none solid
                          solid; border-right-color: windowtext;
                          border-bottom-color: windowtext;
                          border-left-color: windowtext;
                          border-right-width: 1pt; border-bottom-width:
                          1pt; border-left-width: 1pt; padding: 0cm
                          3.5pt; height: 12.75pt;" nowrap="nowrap"
                          valign="bottom" width="64">
                          <p><span style="font-size: 10pt; font-family:
                              Arial;">35-60</span></p>
                        </td>
                        <td style="width: 97.7pt; border-style: none
                          solid solid none; border-bottom-color:
                          windowtext; border-bottom-width: 1pt;
                          border-right-color: windowtext;
                          border-right-width: 1pt; padding: 0cm 3.5pt;
                          height: 12.75pt;" nowrap="nowrap"
                          valign="bottom" width="130">
                          <p><span style="font-size: 10pt; font-family:
                              Arial;"><4</span></p>
                        </td>
                        <td style="width: 37.6pt; border-style: none
                          solid solid none; border-bottom-color:
                          windowtext; border-bottom-width: 1pt;
                          border-right-color: windowtext;
                          border-right-width: 1pt; padding: 0cm 3.5pt;
                          height: 12.75pt;" nowrap="nowrap"
                          valign="bottom" width="50">
                          <p><span style="font-size: 10pt; font-family:
                              Arial;">4.1-8</span></p>
                        </td>
                        <td style="width: 37.6pt; border-style: none
                          solid solid none; border-bottom-color:
                          windowtext; border-bottom-width: 1pt;
                          border-right-color: windowtext;
                          border-right-width: 1pt; padding: 0cm 3.5pt;
                          height: 12.75pt;" nowrap="nowrap"
                          valign="bottom" width="50">
                          <p><span style="font-size: 10pt; font-family:
                              Arial;">8.1-12</span></p>
                        </td>
                        <td style="width: 37.6pt; border-style: none
                          solid solid none; border-bottom-color:
                          windowtext; border-bottom-width: 1pt;
                          border-right-color: windowtext;
                          border-right-width: 1pt; padding: 0cm 3.5pt;
                          height: 12.75pt;" nowrap="nowrap"
                          valign="bottom" width="50">
                          <p><span style="font-size: 10pt; font-family:
                              Arial;">12.1-18</span></p>
                        </td>
                        <td style="width: 52.5pt; border-style: none
                          solid solid none; border-bottom-color:
                          windowtext; border-bottom-width: 1pt;
                          border-right-color: windowtext;
                          border-right-width: 1pt; padding: 0cm 3.5pt;
                          height: 12.75pt;" nowrap="nowrap"
                          valign="bottom" width="70">
                          <p><span style="font-size: 10pt; font-family:
                              Arial;">>18</span></p>
                        </td>
                      </tr>
                      <tr style="height: 12.75pt;">
                        <td style="width: 48pt; border-style: none solid
                          solid; border-right-color: windowtext;
                          border-bottom-color: windowtext;
                          border-left-color: windowtext;
                          border-right-width: 1pt; border-bottom-width:
                          1pt; border-left-width: 1pt; padding: 0cm
                          3.5pt; height: 12.75pt;" nowrap="nowrap"
                          valign="bottom" width="64">
                          <p><span style="font-size: 10pt; font-family:
                              Arial;">15-35</span></p>
                        </td>
                        <td style="width: 97.7pt; border-style: none
                          solid solid none; border-bottom-color:
                          windowtext; border-bottom-width: 1pt;
                          border-right-color: windowtext;
                          border-right-width: 1pt; padding: 0cm 3.5pt;
                          height: 12.75pt;" nowrap="nowrap"
                          valign="bottom" width="130">
                          <p><span style="font-size: 10pt; font-family:
                              Arial;"><6.6</span></p>
                        </td>
                        <td style="width: 37.6pt; border-style: none
                          solid solid none; border-bottom-color:
                          windowtext; border-bottom-width: 1pt;
                          border-right-color: windowtext;
                          border-right-width: 1pt; padding: 0cm 3.5pt;
                          height: 12.75pt;" nowrap="nowrap"
                          valign="bottom" width="50">
                          <p><span style="font-size: 10pt; font-family:
                              Arial;">6.7-12</span></p>
                        </td>
                        <td style="width: 37.6pt; border-style: none
                          solid solid none; border-bottom-color:
                          windowtext; border-bottom-width: 1pt;
                          border-right-color: windowtext;
                          border-right-width: 1pt; padding: 0cm 3.5pt;
                          height: 12.75pt;" nowrap="nowrap"
                          valign="bottom" width="50">
                          <p><span style="font-size: 10pt; font-family:
                              Arial;">12.1-20</span></p>
                        </td>
                        <td style="width: 37.6pt; border-style: none
                          solid solid none; border-bottom-color:
                          windowtext; border-bottom-width: 1pt;
                          border-right-color: windowtext;
                          border-right-width: 1pt; padding: 0cm 3.5pt;
                          height: 12.75pt;" nowrap="nowrap"
                          valign="bottom" width="50">
                          <p><span style="font-size: 10pt; font-family:
                              Arial;">20.1-30</span></p>
                        </td>
                        <td style="width: 52.5pt; border-style: none
                          solid solid none; border-bottom-color:
                          windowtext; border-bottom-width: 1pt;
                          border-right-color: windowtext;
                          border-right-width: 1pt; padding: 0cm 3.5pt;
                          height: 12.75pt;" nowrap="nowrap"
                          valign="bottom" width="70">
                          <p><span style="font-size: 10pt; font-family:
                              Arial;">>30</span></p>
                        </td>
                      </tr>
                      <tr style="height: 12.75pt;">
                        <td style="width: 48pt; border-style: none solid
                          solid; border-right-color: windowtext;
                          border-bottom-color: windowtext;
                          border-left-color: windowtext;
                          border-right-width: 1pt; border-bottom-width:
                          1pt; border-left-width: 1pt; padding: 0cm
                          3.5pt; height: 12.75pt;" nowrap="nowrap"
                          valign="bottom" width="64">
                          <p><span style="font-size: 10pt; font-family:
                              Arial;">0-15</span></p>
                        </td>
                        <td style="width: 97.7pt; border-style: none
                          solid solid none; border-bottom-color:
                          windowtext; border-bottom-width: 1pt;
                          border-right-color: windowtext;
                          border-right-width: 1pt; padding: 0cm 3.5pt;
                          height: 12.75pt;" nowrap="nowrap"
                          valign="bottom" width="130">
                          <p><span style="font-size: 10pt; font-family:
                              Arial;"><10</span></p>
                        </td>
                        <td style="width: 37.6pt; border-style: none
                          solid solid none; border-bottom-color:
                          windowtext; border-bottom-width: 1pt;
                          border-right-color: windowtext;
                          border-right-width: 1pt; padding: 0cm 3.5pt;
                          height: 12.75pt;" nowrap="nowrap"
                          valign="bottom" width="50">
                          <p><span style="font-size: 10pt; font-family:
                              Arial;">10.1-20</span></p>
                        </td>
                        <td style="width: 37.6pt; border-style: none
                          solid solid none; border-bottom-color:
                          windowtext; border-bottom-width: 1pt;
                          border-right-color: windowtext;
                          border-right-width: 1pt; padding: 0cm 3.5pt;
                          height: 12.75pt;" nowrap="nowrap"
                          valign="bottom" width="50">
                          <p><span style="font-size: 10pt; font-family:
                              Arial;">20.1-30</span></p>
                        </td>
                        <td style="width: 37.6pt; border-style: none
                          solid solid none; border-bottom-color:
                          windowtext; border-bottom-width: 1pt;
                          border-right-color: windowtext;
                          border-right-width: 1pt; padding: 0cm 3.5pt;
                          height: 12.75pt;" nowrap="nowrap"
                          valign="bottom" width="50">
                          <p><span style="font-size: 10pt; font-family:
                              Arial;">30.1-45</span></p>
                        </td>
                        <td style="width: 52.5pt; border-style: none
                          solid solid none; border-bottom-color:
                          windowtext; border-bottom-width: 1pt;
                          border-right-color: windowtext;
                          border-right-width: 1pt; padding: 0cm 3.5pt;
                          height: 12.75pt;" nowrap="nowrap"
                          valign="bottom" width="70">
                          <p><span style="font-size: 10pt; font-family:
                              Arial;">>45</span></p>
                        </td>
                      </tr>
                    </tbody>
                  </table>
                </td>
                <td style="border-left-style: none; width: 263pt;"
                  colspan="5" width="348"> </td>
              </tr>
            </tbody>
          </table>
        </div>
        <div>
          <div> </div>
          <div> </div>
          <div>Fiz o seguinte:</div>
          <div>
            <div>solo=c(1:50)                       # resultado da
              análise do solo</div>
            <div>argila=c(60,35,15,0)            # teor de argila</div>
            <div>p1=c(0,2.7,5.4,8,12)             # fósforo com + de 60%
              de argila</div>
            <div>p2=c(0,4,8,12,18)                # fósforo com 35 a
               60% de argila</div>
            <div>p3=c(0,6.6,12,20,30)            # fósforo com 15 a  35%
              de argila</div>
            <div>p4=c(0,10,20,30,45)            # fósforo com < 15%
              de argila</div>
            <div>res=c("Muito.Baixo","Baixo", "Medio", "Alto",
              "Muito.alto")</div>
            <div> </div>
            <div>Assim se o resultado de P é 3.5 :</div>
            <div>60% de arg, seria classificado como Baixo</div>
            <div>35% de arg. seria classificado como muito baixo</div>
            <div> </div>
            <div>andei dando uma olhada na solução do post </div>
            <h1 id="post-title" style="font-family:
              GillSans,Trebuchet,Calibri,Arial,sans-serif; color:
              #333333; font-size: 1.8em; margin: 0.25em 0px 0.8em;">Uso
              do ifelse</h1>
            <div> </div>
          </div>
          <div>A saida desta função seria casada com uma recomendação,</div>
          <div> </div>
          <div>Grato a todos</div>
          <div> </div>
          -- <br>
          Hélio Gallo Rocha<br>
          IFSULDEMINAS - Câmpus Muzambinho</div>
      </div>
      <div> </div>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <br>
      <pre wrap="">_______________________________________________
R-br mailing list
<a class="moz-txt-link-abbreviated" href="mailto:R-br@listas.c3sl.ufpr.br">R-br@listas.c3sl.ufpr.br</a>
<a class="moz-txt-link-freetext" href="https://listas.inf.ufpr.br/cgi-bin/mailman/listinfo/r-br">https://listas.inf.ufpr.br/cgi-bin/mailman/listinfo/r-br</a>
Leia o guia de postagem (<a class="moz-txt-link-freetext" href="http://www.leg.ufpr.br/r-br-guia">http://www.leg.ufpr.br/r-br-guia</a>) e forneça código mínimo reproduzível.</pre>
    </blockquote>
    <br>
  </body>
</html>