<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    <p>Prezados:</p>
    <p>Muito obrigado! Com o sugerido, problema resolvido.</p>
    <p>Elerson<br>
    </p>
    <div class="moz-cite-prefix">Em 04/10/2018 21:21, Fernando Mayer via
      R-br escreveu:<br>
    </div>
    <blockquote type="cite"
cite="mid:CAO4bAdOBGAaNGkW-B5DojiTYFDqtkruCfD+7RZZ9J_WutSaWWQ@mail.gmail.com">
      <meta http-equiv="content-type" content="text/html; charset=UTF-8">
      <div dir="ltr">
        <div dir="ltr">
          <div dir="ltr">
            <div>Basta lembrar que, internamente, os níveis de um fator
              são armazenados como numeros inteiros, por padrão
              coincidentes com a ordem alfabética, ou seja,</div>
            <div><br>
            </div>
            <div>as.numeric(factor(c("A", "B", "C")))<br>
            </div>
            <div><br>
            </div>
            <div>Portanto basta converter o vetor de nomes para fator e
              converter para numérico:</div>
            <div><br>
            </div>
            <div>
              <div>nomes <- c("Alexandre Aguiar Parreiras",</div>
              <div>"Alexandre Aguiar Parreiras",</div>
              <div>"Breno Pereira Galvão",</div>
              <div>"Carlos Daniel Pereira de Souza",</div>
              <div>"Daniel Prates Andrade",</div>
              <div>"Daniel Prates Andrade",</div>
              <div>"Elian Kanaan dos Santos",</div>
              <div>"Érick Daniel Sena de Jesus")</div>
            </div>
            <div><br>
            </div>
            <div>
              <div>nomes <- as.factor(nomes)</div>
              <div><a href="http://nomes.id" moz-do-not-send="true">nomes.id</a>
                <- as.numeric(nomes)</div>
              <div>data.frame(nomes, <a href="http://nomes.id"
                  moz-do-not-send="true">nomes.id</a>)<br>
              </div>
              <div>  </div>
            </div>
            <div>---<br>
            </div>
            <div>
              <div dir="ltr" class="gmail_signature">
                <div dir="ltr">
                  <div>
                    <div dir="ltr">
                      <div>
                        <div dir="ltr">
                          <div dir="ltr">
                            <div dir="ltr">
                              <div dir="ltr">Fernando de Pol Mayer</div>
                              <div dir="ltr">Laboratório de Estatística
                                e Geoinformação - LEG</div>
                              <div dir="ltr">Departamento de Estatística
                                - DEST</div>
                              <div dir="ltr">Universidade Federal do
                                Paraná - UFPR</div>
                              <div>URL: <a
                                  href="http://leg.ufpr.br/~fernandomayer"
                                  target="_blank" moz-do-not-send="true">http://leg.ufpr.br/~fernandomayer</a></div>
                              <div dir="ltr">e-mail: fernando.mayer [@]
                                {<a href="http://gmail.com"
                                  target="_blank" moz-do-not-send="true">gmail.com</a>, <a
                                  href="http://ufpr.br" target="_blank"
                                  moz-do-not-send="true">ufpr.br</a>}</div>
                            </div>
                          </div>
                        </div>
                      </div>
                    </div>
                  </div>
                </div>
              </div>
            </div>
            <br>
          </div>
        </div>
      </div>
      <br>
      <div class="gmail_quote">
        <div dir="ltr">On Thu, Oct 4, 2018 at 3:07 PM Luís G. Silva e
          Silva via R-br <<a href="mailto:r-br@listas.c3sl.ufpr.br"
            moz-do-not-send="true">r-br@listas.c3sl.ufpr.br</a>>
          wrote:<br>
        </div>
        <blockquote class="gmail_quote" style="margin:0 0 0
          .8ex;border-left:1px #ccc solid;padding-left:1ex">
          <div dir="ltr">Olá,
            <div><br>
            </div>
            <div>Usando o pacote dplyr ficaria assim:<br>
              <br>
              library(dplyr)</div>
            <div>
              <div>nomes <- c("Alexandre Aguiar Parreiras",</div>
              <div>"Alexandre Aguiar Parreiras",</div>
              <div>"Breno Pereira Galvão",</div>
              <div>"Carlos Daniel Pereira de Souza",</div>
              <div>"Daniel Prates Andrade",</div>
              <div>"Daniel Prates Andrade",</div>
              <div>"Elian Kanaan dos Santos",</div>
              <div>"Érick Daniel Sena de Jesus")</div>
              <div><br>
              </div>
              <div>df <- data.frame(nomes)</div>
              <div>df <- df %>%</div>
              <div>  mutate(id = 1:n()) %>%</div>
              <div>  group_by(nomes) %>%</div>
              <div>  mutate(id = first(id))</div>
              <div>df</div>
            </div>
            <div><br>
            </div>
            <div><br>
            </div>
            <div>Abraço</div>
            <div dir="ltr">
              <div dir="ltr"><br>
                <div class="gmail_quote">
                  <div dir="ltr">On Thu, Oct 4, 2018 at 3:00 PM Amiko Bh
                    via R-br <<a
                      href="mailto:r-br@listas.c3sl.ufpr.br"
                      target="_blank" moz-do-not-send="true">r-br@listas.c3sl.ufpr.br</a>>
                    wrote:<br>
                  </div>
                  <blockquote class="gmail_quote" style="margin:0 0 0
                    .8ex;border-left:1px #ccc solid;padding-left:1ex">
                    <div dir="ltr">
                      <div dir="ltr">
                        <div dir="ltr">
                          <div>
                            <div>
                              <div>
                                <div>Pessoal: Não consegui achar
                                  instruções a respeito.<br>
                                </div>
                                Quero codificar (criar id?) nomes em um
                                enorme banco de dados.<br>
                              </div>
                              Há vários nomes que se repetem. Estes
                              teriam que ter a mesma identificação.<br>
                              <br>
                            </div>
                            Exemplo:<br>
                            <br>
                          </div>
                          Deste banco:<br>
                          <br>
                          <table cellspacing="0" border="0">
                            <colgroup width="224"></colgroup> <tbody>
                              <tr>
                                <td height="17" align="left">Nome:</td>
                              </tr>
                              <tr>
                                <td
                                  style="border-width:1px;border-style:solid;border-color:rgb(0,0,0)"
                                  valign="middle" height="17"
                                  align="left"><font color="#000000">Alexandre
                                    Aguiar Parreiras</font></td>
                              </tr>
                              <tr>
                                <td
                                  style="border-width:1px;border-style:solid;border-color:rgb(0,0,0)"
                                  valign="middle" height="17"
                                  align="left"><font color="#000000">Alexandre
                                    Aguiar Parreiras</font></td>
                              </tr>
                              <tr>
                                <td
                                  style="border-width:1px;border-style:solid;border-color:rgb(0,0,0)"
                                  valign="middle" height="17"
                                  align="left"><font color="#000000">Breno
                                    Pereira Galvão</font></td>
                              </tr>
                              <tr>
                                <td
                                  style="border-width:1px;border-style:solid;border-color:rgb(0,0,0)"
                                  valign="middle" height="17"
                                  align="left"><font color="#000000">Carlos
                                    Daniel Pereira de Souza</font></td>
                              </tr>
                              <tr>
                                <td
                                  style="border-width:1px;border-style:solid;border-color:rgb(0,0,0)"
                                  valign="middle" height="17"
                                  align="left"><font color="#000000">Daniel
                                    Prates Andrade</font></td>
                              </tr>
                              <tr>
                                <td
                                  style="border-width:1px;border-style:solid;border-color:rgb(0,0,0)"
                                  valign="middle" height="17"
                                  align="left"><font color="#000000">Daniel
                                    Prates Andrade</font></td>
                              </tr>
                              <tr>
                                <td
                                  style="border-width:1px;border-style:solid;border-color:rgb(0,0,0)"
                                  valign="middle" height="17"
                                  align="left"><font color="#000000">Elian
                                    Kanaan dos Santos</font></td>
                              </tr>
                              <tr>
                                <td
                                  style="border-width:1px;border-style:solid;border-color:rgb(0,0,0)"
                                  valign="middle" height="17"
                                  align="left"><font color="#000000">Érick
                                    Daniel Sena de Jesus</font></td>
                              </tr>
                            </tbody>
                          </table>
                          <br>
                        </div>
                        <div>Quero ter este:<br>
                          <br>
                          <table cellspacing="0" border="0">
                            <colgroup width="224"></colgroup> <colgroup
                              width="85"></colgroup> <tbody>
                              <tr>
                                <td height="17" align="left">Nome:</td>
                                <td align="left">ID</td>
                              </tr>
                              <tr>
                                <td
                                  style="border-width:1px;border-style:solid;border-color:rgb(0,0,0)"
                                  valign="middle" height="17"
                                  align="left"><font color="#000000">Alexandre
                                    Aguiar Parreiras</font></td>
                                <td
                                  style="border-width:1px;border-style:solid;border-color:rgb(0,0,0)"
                                  valign="middle" align="center">1</td>
                              </tr>
                              <tr>
                                <td
                                  style="border-width:1px;border-style:solid;border-color:rgb(0,0,0)"
                                  valign="middle" height="17"
                                  align="left"><font color="#000000">Alexandre
                                    Aguiar Parreiras</font></td>
                                <td
                                  style="border-width:1px;border-style:solid;border-color:rgb(0,0,0)"
                                  valign="middle" align="center">1</td>
                              </tr>
                              <tr>
                                <td
                                  style="border-width:1px;border-style:solid;border-color:rgb(0,0,0)"
                                  valign="middle" height="17"
                                  align="left"><font color="#000000">Breno
                                    Pereira Galvão</font></td>
                                <td
                                  style="border-width:1px;border-style:solid;border-color:rgb(0,0,0)"
                                  valign="middle" align="center">2</td>
                              </tr>
                              <tr>
                                <td
                                  style="border-width:1px;border-style:solid;border-color:rgb(0,0,0)"
                                  valign="middle" height="17"
                                  align="left"><font color="#000000">Carlos
                                    Daniel Pereira de Souza</font></td>
                                <td
                                  style="border-width:1px;border-style:solid;border-color:rgb(0,0,0)"
                                  valign="middle" align="center">3</td>
                              </tr>
                              <tr>
                                <td
                                  style="border-width:1px;border-style:solid;border-color:rgb(0,0,0)"
                                  valign="middle" height="17"
                                  align="left"><font color="#000000">Daniel
                                    Prates Andrade</font></td>
                                <td
                                  style="border-width:1px;border-style:solid;border-color:rgb(0,0,0)"
                                  valign="middle" align="center">4</td>
                              </tr>
                              <tr>
                                <td
                                  style="border-width:1px;border-style:solid;border-color:rgb(0,0,0)"
                                  valign="middle" height="17"
                                  align="left"><font color="#000000">Daniel
                                    Prates Andrade</font></td>
                                <td
                                  style="border-width:1px;border-style:solid;border-color:rgb(0,0,0)"
                                  valign="middle" align="center"><font
                                    face="Arial">4</font></td>
                              </tr>
                              <tr>
                                <td
                                  style="border-width:1px;border-style:solid;border-color:rgb(0,0,0)"
                                  valign="middle" height="17"
                                  align="left"><font color="#000000">Elian
                                    Kanaan dos Santos</font></td>
                                <td
                                  style="border-width:1px;border-style:solid;border-color:rgb(0,0,0)"
                                  valign="middle" align="center">5</td>
                              </tr>
                              <tr>
                                <td
                                  style="border-width:1px;border-style:solid;border-color:rgb(0,0,0)"
                                  valign="middle" height="17"
                                  align="left"><font color="#000000">Érick
                                    Daniel Sena de Jesus</font></td>
                                <td
                                  style="border-width:1px;border-style:solid;border-color:rgb(0,0,0)"
                                  valign="middle" align="center">6</td>
                              </tr>
                            </tbody>
                          </table>
                          <br>
                        </div>
                        <div>Muito Obrigado.<br>
                        </div>
                      </div>
                    </div>
                    _______________________________________________<br>
                    R-br mailing list<br>
                    <a href="mailto:R-br@listas.c3sl.ufpr.br"
                      target="_blank" moz-do-not-send="true">R-br@listas.c3sl.ufpr.br</a><br>
                    <a
                      href="https://listas.inf.ufpr.br/cgi-bin/mailman/listinfo/r-br"
                      rel="noreferrer" target="_blank"
                      moz-do-not-send="true">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="noreferrer" target="_blank"
                      moz-do-not-send="true">http://www.leg.ufpr.br/r-br-guia</a>)
                    e forneça código mínimo reproduzível.</blockquote>
                </div>
              </div>
            </div>
            <div dir="ltr">-- <br>
              <div dir="ltr"
class="m_4373245408338207436m_4478733554146254713m_1134206935586516095gmail_signature"
                data-smartmail="gmail_signature">
                <div dir="ltr">
                  <p dir="ltr">Luís G. Silva e Silva</p>
                </div>
              </div>
            </div>
          </div>
          _______________________________________________<br>
          R-br mailing list<br>
          <a href="mailto:R-br@listas.c3sl.ufpr.br" target="_blank"
            moz-do-not-send="true">R-br@listas.c3sl.ufpr.br</a><br>
          <a
            href="https://listas.inf.ufpr.br/cgi-bin/mailman/listinfo/r-br"
            rel="noreferrer" target="_blank" moz-do-not-send="true">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="noreferrer"
            target="_blank" moz-do-not-send="true">http://www.leg.ufpr.br/r-br-guia</a>)
          e forneça código mínimo reproduzível.</blockquote>
      </div>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <pre class="moz-quote-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>
  </body>
</html>