<div dir="ltr">Tenta usar o %in% para reduzir os ifelse() (Não sei se é o caso, mas a função SE() do excel tem limite encadeiamentos, pode ser o caso aqui também)... Ex:<div><br></div><div>Todos esses ifelse()'s:</div>
<div><br></div><div><span style="font-family:arial,sans-serif;font-size:13px">ifelse((origin=="am") & (destination=="ro"),1,ifelse((</span><span style="font-family:arial,sans-serif;font-size:13px">origin=="am") & (destination=="rr"),1,ifelse((</span><span style="font-family:arial,sans-serif;font-size:13px">origin=="am") & (destination=="pa"),1,ifelse((</span><span style="font-family:arial,sans-serif;font-size:13px">origin=="am") & (destination=="mt"),1</span><br>
</div><div><span style="font-family:arial,sans-serif;font-size:13px"><br></span></div><div><span style="font-family:arial,sans-serif;font-size:13px">Podem ser substituido por:</span></div><div><span style="font-family:arial,sans-serif;font-size:13px"><br>
</span></div><div><font face="arial, sans-serif">ifelse(origin=="am" & destination %in% c("ro", "rr", "pa", "mt"),1, ifelse(...))</font><br></div><div><font face="arial, sans-serif"><br>
</font></div><div><font face="arial, sans-serif">E ainda assim acho que não é o mais adequado... Dependendo de como estão os teus dados, eu usaria um merge() para resolver o problema</font></div><div><font face="arial, sans-serif"><br>
</font></div><div><font face="arial, sans-serif"><br></font></div><div><font face="arial, sans-serif">[]'s</font></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">2014-04-25 20:17 GMT-03:00 Alexandre Loures <span dir="ltr"><<a href="mailto:alexandre.loures@ymail.com" target="_blank">alexandre.loures@ymail.com</a>></span>:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
  

    
  
  <div bgcolor="#FFFFFF" text="#000000">
    Boa noite!<br>
    <br>
    <br>
    Estou usando a rotina abaixo para construir uma dummy para as
    fronteiras dos estados brasileiros. Porém, quando tendo rodar o R
    reporta o seguinte erro:<br>
    <br>
    Erro: estouro da pilha de contexto na linha 18<br>
    <br>
    <br>
    O que devo fazer?<br>
    <br>
    <br>
    mydata$contiguity<-ifelse((origin=="ac") &
    (destination=="am"),1,<br>
    ifelse((origin=="am") &
    (destination=="ro"),1,ifelse((origin=="am") &
    (destination=="rr"),1,ifelse((origin=="am") &
    (destination=="pa"),1,ifelse((origin=="am") &
    (destination=="mt"),1,<br>
    ifelse((origin=="ro") &
    (destination=="mt"),1,ifelse((origin=="ro") &
    (destination=="am"),1,<br>
    ifelse((origin=="rr") &
    (destination=="am"),1,ifelse((origin=="rr") &
    (destination=="pa"),1,<br>
    ifelse((origin=="pa") &
    (destination=="mt"),1,ifelse((origin=="pa") &
    (destination=="am"),1,ifelse((origin=="pa") &
    (destination=="am"),1,ifelse((origin=="pa") &
    (destination=="rr"),1,<br>
    ifelse((origin=="pa") &
    (destination=="ap"),1,ifelse((origin=="pa") &
    (destination=="ma"),1,ifelse((origin=="pa") &
    (destination=="to"),1,ifelse((origin=="pa") &
    (destination=="mt"),1,<br>
    ifelse((origin=="ap") & (destination=="pa"),1,<br>
    ifelse((origin=="ma") &
    (destination=="pa"),1,ifelse((origin=="ma") &
    (destination=="to"),1,ifelse((origin=="ma") &
    (destination=="pi"),1,<br>
    ifelse((origin=="pi") &
    (destination=="ma"),1,ifelse((origin=="pi") &
    (destination=="to"),1,ifelse((origin=="pi") &
    (destination=="pe"),1,ifelse((origin=="pi") &
    (destination=="ce"),1,<br>
    ifelse((origin=="ce") &
    (destination=="pi"),1,ifelse((origin=="ce") &
    (destination=="pe"),1,ifelse((origin=="ce") &
    (destination=="pb"),1,ifelse((origin=="ce") &
    (destination=="rn"),1,<br>
    ifelse((origin=="rn") &
    (destination=="ce"),1,ifelse((origin=="rn") &
    (destination=="pb"),1,<br>
    ifelse((origin=="pb") &
    (destination=="rn"),1,ifelse((origin=="pb") &
    (destination=="ce"),1,ifelse((origin=="pb") &
    (destination=="pe"),1,<br>
    ifelse((origin=="pe") &
    (destination=="pb"),1,ifelse((origin=="pe") &
    (destination=="ce"),1,ifelse((origin=="pe") &
    (destination=="pi"),1,ifelse((origin=="pe") &
    (destination=="ba"),1,<br>
    ifelse((origin=="pe") & (destination=="al"),1,<br>
    ifelse((origin=="al") &
    (destination=="pe"),1,ifelse((origin=="al") &
    (destination=="ba"),1,ifelse((origin=="al") &
    (destination=="se"),1,<br>
    ifelse((origin=="se") &
    (destination=="al"),1,ifelse((origin=="se") &
    (destination=="ba"),1,<br>
    ifelse((origin=="ba") &
    (destination=="se"),1,ifelse((origin=="ba") &
    (destination=="al"),1,ifelse((origin=="ba") &
    (destination=="pe"),1,ifelse((origin=="ba") &
    (destination=="pi"),1,<br>
    ifelse((origin=="ba") &
    (destination=="to"),1,ifelse((origin=="ba") &
    (destination=="go"),1,ifelse((origin=="ba") &
    (destination=="mg"),1,ifelse((origin=="ba") &
    (destination=="es"),1,<br>
    ifelse((origin=="to") &
    (destination=="pa"),1,ifelse((origin=="to") &
    (destination=="mt"),1,ifelse((origin=="to") &
    (destination=="go"),1,ifelse((origin=="to") &
    (destination=="ba"),1,<br>
    ifelse((origin=="to") &
    (destination=="pi"),1,ifelse((origin=="to") &
    (destination=="ma"),1,<br>
    ifelse((origin=="mt") &
    (destination=="ro"),1,ifelse((origin=="mt") &
    (destination=="am"),1,ifelse((origin=="mt") &
    (destination=="pa"),1,ifelse((origin=="mt") &
    (destination=="to"),1,<br>
    ifelse((origin=="mt") &
    (destination=="go"),1,ifelse((origin=="mt") &
    (destination=="ms"),1,<br>
    ifelse((origin=="ms") &
    (destination=="mt"),1,ifelse((origin=="ms") &
    (destination=="go"),1,ifelse((origin=="ms") &
    (destination=="mg"),1,ifelse((origin=="ms") &
    (destination=="sp"),1,<br>
    ifelse((origin=="ms") & (destination=="pr"),1,<br>
    ifelse((origin=="go") &
    (destination=="mg"),1,ifelse((origin=="go") &
    (destination=="ba"),1,ifelse((origin=="go") &
    (destination=="to"),1,ifelse((origin=="go") &
    (destination=="mt"),1,<br>
    ifelse((origin=="go") &
    (destination=="ms"),1,ifelse((origin=="go") &
    (destination=="df"),1,<br>
    ifelse((origin=="mg") &
    (destination=="sp"),1,ifelse((origin=="mg") &
    (destination=="rj"),1,ifelse((origin=="mg") &
    (destination=="es"),1,ifelse((origin=="mg") &
    (destination=="ba"),1,<br>
    ifelse((origin=="mg") &
    (destination=="go"),1,ifelse((origin=="mg") &
    (destination=="ms"),1,<br>
    ifelse((origin=="sp") &
    (destination=="rj"),1,ifelse((origin=="sp") &
    (destination=="mg"),1,ifelse((origin=="sp") &
    (destination=="ms"),1,ifelse((origin=="sp") &
    (destination=="pr"),1,<br>
    ifelse((origin=="rj") &
    (destination=="mg"),1,ifelse((origin=="rj") &
    (destination=="mg"),1,ifelse((origin=="rj") &
    (destination=="es"),1,<br>
    ifelse((origin=="es") &
    (destination=="ba"),1,ifelse((origin=="es") &
    (destination=="mg"),1,ifelse((origin=="es") &
    (destination=="rj"),1,<br>
    ifelse((origin=="pr") &
    (destination=="sp"),1,ifelse((origin=="pr") &
    (destintaion=="sc"),1,ifelse((origin=="pr") &
    (destination=="ms"),1,<br>
    ifelse((origin=="sc") &
    (destination=="pr"),1,ifelse((origin=="sc") &
    (destination=="rs"),1,<br>
    ifelse((origin=="rs") & (destination=="sc"),1,<br>
    ifelse((origin=="df") &
(destination=="go"),1,0))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))<span class="HOEnZb"><font color="#888888"><br>
    <br>
    <br>
    <br>
    <div>-- <br>
      <font size="1"><b>Alexandre Rodrigues Loures</b><br>
      </font></div>
  </font></span></div>

<br>_______________________________________________<br>
R-br mailing list<br>
<a href="mailto:R-br@listas.c3sl.ufpr.br">R-br@listas.c3sl.ufpr.br</a><br>
<a href="https://listas.inf.ufpr.br/cgi-bin/mailman/listinfo/r-br" 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" target="_blank">http://www.leg.ufpr.br/r-br-guia</a>) e forneça código mínimo reproduzível.<br></blockquote></div><br></div>