<div dir="ltr"><div style>André, vou tentar...</div><div><br></div><div style>Já fiz o seguinte, segundo exemplo anterior da lista...</div><div style><br></div><div style>A recomendação de fósforo depende do nível de argila presente no solo, então primeiro classifiquei o nível de argila da amostra,</div>
<div style><br></div><div style>CRM</div><div style><br></div><div style><div>arg=rep(seq(10,70,20),5)                     #dados de argila</div><div>class_arg=c(0,15,35,60,100)                #niveis da argila</div><div>
resarg=c("MB","B","M","A")                #classes da argila</div><div>ca=cut(arg,class_arg,resarg)</div><div>data.frame(arg,ca)   #arg=dados e  ca é  a classe de nível de argila</div>
<div><br></div><div style>Até ai ok</div><div><br></div><div>p=c(9, 5,3,2,15,8,5,4,25,15,10,7,35,15,10,7,50,35,20,15)# valores de fosforo</div><div>t=data.frame(p,ca);t ; #ONDE P=NIVEL DE P(dados) E K CLASSE DE ARGILA DAQUELA AMOSTRA DE P</div>
<div><br></div><div style># até aqui, tudo certo, nível de argila classificada casada com a quantidade de fosforo</div><div><br></div><div>#classificação de fosforo</div><div>n1=c(0,2.7,5.4,8,12,100);n1  # nivel classificação de fósforo com mais de 60% de argila</div>
<div style><br></div><div style>#vou explicar n1</div><div style>#onde <2.7                    --nível muito baixo de fosforo com +60% argila</div><div style># entre 2.8 e 5.4             -- nível baixo de fosforo com +60% argila</div>
<div style># entre  5.5 e 8               -- nível médio de  fosforo com +60% argila</div><div style>#entre 8.1 e 12               -- nível alto defosforo com +60% argila</div><div style><br></div><div style>#e assim sucessivamente</div>
<div><br></div><div>n2=c(0,4,8,12,18,100);n2    # classificação de fósforo com 35 a  60% de argila</div><div>n3=c(0,6.6,12,20,30,100);n3  # classificação de fósforo com 15 a  35% de argila</div><div>n4=c(0,10,20,30,45,100);n4 # classificação de fósforo com menos de 15% de argila</div>
<div><br></div><div>resp=c("Muito.Baixo","Baixo", "Medio", "Bom", "Muito.bom") ;resp</div><div><br></div><div>t$classi=ifelse(t$ca=="B",</div><div>  cut(t$p, n1, resp, inc=T , right=F, ord=T),</div>
<div>  cut(t$p, n2, resp, inc=T , right=F, ord=T,</div><div>  cut(t$p, n3, resp, inc=T , right=F, ord=T),</div><div>  cut(t$p, n4, resp, inc=T , right=F, ord=T)))</div><div><br></div><div>t$classi=factor(t$classi, lev=1:5, lab=resp, ord=T)</div>
<div>data.frame(t)    # resultado errado</div><div><br></div><div style>Deveria dar uma sequencia de :</div><div style>4xMuito.Baixo,</div><div style>4x Baixo,</div><div style>4X Medio,</div><div style>4x Bom e</div><div style>
4x Muito.Bom</div><div><br></div><div><br></div><div><br></div><div style>Me parece que esta função funciona quando tenho dois níveis de argila, mas como são 4</div><div><br></div><div style>Grato</div></div></div><div class="gmail_extra">
<br><br><div class="gmail_quote">Em 18 de maio de 2013 17:48, andrebvs [via R-br] <span dir="ltr"><<a href="mailto:ml-node+s2285057n4659356h4@n4.nabble.com" target="_blank">ml-node+s2285057n4659356h4@n4.nabble.com</a>></span> escreveu:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

        <div>Não ficou claro o que vc está querendo colega, poderia ser mais claro?<br><br><em>Att.</em><br><em>André</em></div>
<div> </div>
<hr style="border-top:1px solid #ccc">
<div>Em 18/05/2013 09:28, <strong>Hélio Gallo Rocha < <a href="http://user/SendEmail.jtp?type=node&node=4659356&i=0" rel="nofollow" link="external" target="_blank">[hidden email]</a> ></strong> escreveu:</div>
<div><div class="h5">
<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" width="412" border="0" cellspacing="0" cellpadding="0"><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="min-height:12.75pt">
<td style="min-height:12.75pt;width:48pt" width="64" height="17"> Tabela da quinta aproximação 
<table style="width:311pt;margin-left:3pt;border-collapse:collapse" width="415" border="0" cellspacing="0" cellpadding="0">
<tbody>
<tr style="min-height:12.75pt">
<td style="width:48pt;border:1pt solid windowtext;padding:0cm 3.5pt;min-height:12.75pt" valign="bottom" nowrap 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;min-height:12.75pt" colspan="5" valign="bottom" nowrap 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="min-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;min-height:12.75pt" valign="bottom" nowrap 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;min-height:12.75pt" valign="bottom" nowrap 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;min-height:12.75pt" valign="bottom" nowrap 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;min-height:12.75pt" valign="bottom" nowrap 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;min-height:12.75pt" valign="bottom" nowrap 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;min-height:12.75pt" valign="bottom" nowrap width="70">

<p><span style="font-size:10pt;font-family:Arial">Muito Bom</span></p>
</td>
</tr>
<tr style="min-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;min-height:12.75pt" valign="bottom" nowrap 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;min-height:12.75pt" valign="bottom" nowrap 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;min-height:12.75pt" valign="bottom" nowrap 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;min-height:12.75pt" valign="bottom" nowrap 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;min-height:12.75pt" valign="bottom" nowrap 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;min-height:12.75pt" valign="bottom" nowrap width="70">

<p><span style="font-size:10pt;font-family:Arial">>12</span></p>
</td>
</tr>
<tr style="min-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;min-height:12.75pt" valign="bottom" nowrap 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;min-height:12.75pt" valign="bottom" nowrap 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;min-height:12.75pt" valign="bottom" nowrap 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;min-height:12.75pt" valign="bottom" nowrap 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;min-height:12.75pt" valign="bottom" nowrap 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;min-height:12.75pt" valign="bottom" nowrap width="70">

<p><span style="font-size:10pt;font-family:Arial">>18</span></p>
</td>
</tr>
<tr style="min-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;min-height:12.75pt" valign="bottom" nowrap 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;min-height:12.75pt" valign="bottom" nowrap 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;min-height:12.75pt" valign="bottom" nowrap 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;min-height:12.75pt" valign="bottom" nowrap 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;min-height:12.75pt" valign="bottom" nowrap 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;min-height:12.75pt" valign="bottom" nowrap width="70">

<p><span style="font-size:10pt;font-family:Arial">>30</span></p>
</td>
</tr>
<tr style="min-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;min-height:12.75pt" valign="bottom" nowrap 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;min-height:12.75pt" valign="bottom" nowrap 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;min-height:12.75pt" valign="bottom" nowrap 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;min-height:12.75pt" valign="bottom" nowrap 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;min-height:12.75pt" valign="bottom" nowrap 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;min-height:12.75pt" valign="bottom" nowrap 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 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></div></div>_______________________________________________
<br>R-br mailing list
<br><a href="http://user/SendEmail.jtp?type=node&node=4659356&i=1" rel="nofollow" link="external" target="_blank">[hidden email]</a>
<br><a href="https://listas.inf.ufpr.br/cgi-bin/mailman/listinfo/r-br" rel="nofollow" link="external" target="_blank">https://listas.inf.ufpr.br/cgi-bin/mailman/listinfo/r-br</a><br>Leia o guia de postagem (<a href="http://www.leg.ufpr.br/r-br-guia" rel="nofollow" link="external" target="_blank">http://www.leg.ufpr.br/r-br-guia</a>) e forneça código mínimo reproduzível.

        
        
        
        <br>
        <br>
        <hr noshade size="1" color="#cccccc">
        <div style="color:#444;font:12px tahoma,geneva,helvetica,arial,sans-serif">
                <div style="font-weight:bold">If you reply to this email, your message will be added to the discussion below:</div>
                <a href="http://r-br.2285057.n4.nabble.com/R-br-Classificar-fosforo-e-textura-do-solo-tp4659355p4659356.html" target="_blank">http://r-br.2285057.n4.nabble.com/R-br-Classificar-fosforo-e-textura-do-solo-tp4659355p4659356.html</a>
        </div>
        <div style="color:#666;font:11px tahoma,geneva,helvetica,arial,sans-serif;margin-top:.4em;line-height:1.5em">
                
                To unsubscribe from R-br, <a href="http://r-br.2285057.n4.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=3357982&code=aGVsaW9nYWxsb3JvY2hhQGdtYWlsLmNvbXwzMzU3OTgyfC0xMzQ3NTkwMDY4" target="_blank">click here</a>.<br>

                <a href="http://r-br.2285057.n4.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml" rel="nofollow" style="font:9px serif" target="_blank">NAML</a>
        </div></blockquote></div><br><br clear="all"><div><br></div>-- <br>Hélio Gallo Rocha<br>IFSULDEMINAS - Câmpus Muzambinho<br>
</div>