<div dir="ltr"><div class="gmail_default" style="font-family:verdana,sans-serif">Outra ideia...</div><div class="gmail_default" style="font-family:verdana,sans-serif"><br></div><div class="gmail_default" style=""><div class="gmail_default"><font face="monospace, monospace">df <- data.frame(</font></div><div class="gmail_default"><font face="monospace, monospace"> ATO_1=c("ART 121", "ART 33", "ART 121", "ART 155", "ART 28", "ART 121", "ART 15"),</font></div><div class="gmail_default"><font face="monospace, monospace"> ATO_2=c("ART 155", "ART 28", "ART 15", "ART 33", "ART 33", "ART 121", "ART 121"),</font></div><div class="gmail_default"><font face="monospace, monospace"> ATO_3=c("ART 180", "ART 10", "ART 155", "ART 121", "ART 33", "ART 121","ART 180"))</font></div><div class="gmail_default"><font face="monospace, monospace"><br></font></div><div class="gmail_default"><font face="monospace, monospace">tab <- sapply(df, table); tab</font></div><div class="gmail_default"><font face="monospace, monospace"><br></font></div><div class="gmail_default"><font face="monospace, monospace">addmargins(tab)</font></div><div class="gmail_default"><font face="monospace, monospace"><br></font></div><div class="gmail_default"><div class="gmail_default"><font face="monospace, monospace"># ATO_1 ATO_2 ATO_3 Sum</font></div><div class="gmail_default"><font face="monospace, monospace"># ART 121 3 2 1 6</font></div><div class="gmail_default"><font face="monospace, monospace"># ART 15 1 1 2 4</font></div><div class="gmail_default"><font face="monospace, monospace"># ART 155 1 1 1 3</font></div><div class="gmail_default"><font face="monospace, monospace"># ART 28 1 1 2 4</font></div><div class="gmail_default"><font face="monospace, monospace"># ART 33 1 2 1 4</font></div><div class="gmail_default"><font face="monospace, monospace"># Sum 7 7 7 21</font></div></div></div></div><div class="gmail_extra"><br clear="all"><div><div class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><font face="arial, helvetica, sans-serif" style="font-size:small"><div style="font-family:'trebuchet ms',sans-serif;display:inline"></div></font><font face="arial, helvetica, sans-serif" style="font-size:12.8px"><span style="font-size:small">================================================</span><br>Éder Comunello</font><div style="font-size:12.8px"><span style="font-family:arial,helvetica,sans-serif">Agronomist (UEM), MSc in Environ. Sciences (UEM)</span><font face="arial, helvetica, sans-serif"><br></font></div><div style="font-size:12.8px"><div style="font-size:small"><span style="font-family:arial,helvetica,sans-serif">DSc in Agricultural Systems Engineering (USP/Esalq)</span><br></div><div><span style="font-size:small">Brazilian Agricultural Research Corporation (</span><font face="arial, helvetica, sans-serif" style="font-size:small">Embrapa)</font></div><div><div><font face="arial, helvetica, sans-serif" style="font-size:small">Dourados, MS, Brazil </font><font face="arial, helvetica, sans-serif" size="2">|<O>|</font></div><div style="font-size:small"><span style="font-family:arial,helvetica,sans-serif">================================================</span><br></div></div></div><div style="font-size:small"><font face="arial, helvetica, sans-serif">GEO, </font>-22.2752, -54.8182, 408m<span style="font-family:arial,helvetica,sans-serif"><br></span></div><div style="font-size:12.8px"><span style="font-size:small;font-family:arial,helvetica,sans-serif">UTC-04:00 / DST: UTC-03:00</span></div><div><div><div><br></div><div><br></div></div><div style="font-size:small"><br></div></div></div></div></div></div></div></div></div></div></div>
<br><div class="gmail_quote">Em 26 de maio de 2016 17:31, salah <span dir="ltr"><<a href="mailto:salah3.1416@gmail.com" target="_blank">salah3.1416@gmail.com</a>></span> escreveu:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div bgcolor="#FFFFFF" text="#000000">
Caro<br>
<br>
Segue sugestões<br>
<br>
library(reshape2)<br>
ATO$id = 1:7 ##acrescenta uma coluna de controle para o melt<br>
##remodelando sua tabela<br>
ATOMelt = melt(ATO, id="id", <a href="http://variable.name" target="_blank">variable.name</a>="ATO_n",
<a href="http://value.name" target="_blank">value.name</a>="ART")<br>
<br>
##usando dplyr<br>
library(dplyr)<br>
ATOMelt %>% count(ART)<br>
<br>
##usando o poderoso data.table<br>
library(data.table)<br>
setDT(ATOMelt) ##converte para data.table<br>
##contando<br>
ATOMelt[, .N, by = .(ART)]<br>
<br>
saudações<div><div class="h5"><br>
<br>
<div>Em 26/05/2016 16:28, Amiko Bh escreveu:<br>
</div>
</div></div><blockquote type="cite"><div><div class="h5">
<div dir="ltr">
<div>Pessoal,</div>
<div><br>
</div>
<div>Dado o banco:</div>
<div><br>
</div>
<div>
<table style="border:medium;border-collapse:collapse" cellpadding="0" cellspacing="0" border="1">
<tbody>
<tr style="height:14.3pt">
<td style="padding:0cm 5.4pt;border:1pt solid windowtext;width:53pt;height:14.3pt;background-color:transparent" valign="top" width="71">
<p style="margin:0cm 0cm 0pt;text-align:center;line-height:normal" align="center"><b><span style="font-size:14pt"><font color="#000000" face="Calibri">ATO_1</font></span></b></p>
</td>
<td style="border-width:1pt 1pt 1pt 0px;border-style:solid solid solid none;border-color:windowtext windowtext windowtext rgb(0,0,0);padding:0cm 5.4pt;width:53pt;height:14.3pt;background-color:transparent" valign="top" width="71">
<p style="margin:0cm 0cm 0pt;text-align:center;line-height:normal" align="center"><b><span style="font-size:14pt"><font color="#000000" face="Calibri">ATO_2</font></span></b></p>
</td>
<td style="border-width:1pt 1pt 1pt 0px;border-style:solid solid solid none;border-color:windowtext windowtext windowtext rgb(0,0,0);padding:0cm 5.4pt;width:53pt;height:14.3pt;background-color:transparent" valign="top" width="71">
<p style="margin:0cm 0cm 0pt;text-align:center;line-height:normal" align="center"><b><span style="font-size:14pt"><font color="#000000" face="Calibri">ATO_3</font></span></b></p>
</td>
</tr>
<tr style="height:13.9pt">
<td style="border-width:0px 1pt 1pt;border-style:none solid solid;border-color:rgb(0,0,0) windowtext windowtext;padding:0cm 5.4pt;width:53pt;height:13.9pt;background-color:transparent" valign="top" width="71">
<p style="margin:0cm 0cm 0pt;line-height:normal"><font color="#000000" face="Calibri">ART 121</font></p>
</td>
<td style="border-width:0px 1pt 1pt 0px;border-style:none solid solid none;border-color:rgb(0,0,0) windowtext windowtext rgb(0,0,0);padding:0cm 5.4pt;width:53pt;height:13.9pt;background-color:transparent" valign="top" width="71">
<p style="margin:0cm 0cm 0pt;line-height:normal"><font color="#000000" face="Calibri">ART 155</font></p>
</td>
<td style="border-width:0px 1pt 1pt 0px;border-style:none solid solid none;border-color:rgb(0,0,0) windowtext windowtext rgb(0,0,0);padding:0cm 5.4pt;width:53pt;height:13.9pt;background-color:transparent" valign="top" width="71">
<p style="margin:0cm 0cm 0pt;line-height:normal"><font color="#000000" face="Calibri">ART 180</font></p>
</td>
</tr>
<tr style="height:13.9pt">
<td style="border-width:0px 1pt 1pt;border-style:none solid solid;border-color:rgb(0,0,0) windowtext windowtext;padding:0cm 5.4pt;width:53pt;height:13.9pt;background-color:transparent" valign="top" width="71">
<p style="margin:0cm 0cm 0pt;line-height:normal"><font color="#000000" face="Calibri">ART 33</font></p>
</td>
<td style="border-width:0px 1pt 1pt 0px;border-style:none solid solid none;border-color:rgb(0,0,0) windowtext windowtext rgb(0,0,0);padding:0cm 5.4pt;width:53pt;height:13.9pt;background-color:transparent" valign="top" width="71">
<p style="margin:0cm 0cm 0pt;line-height:normal"><font color="#000000" face="Calibri">ART 28</font></p>
</td>
<td style="border-width:0px 1pt 1pt 0px;border-style:none solid solid none;border-color:rgb(0,0,0) windowtext windowtext rgb(0,0,0);padding:0cm 5.4pt;width:53pt;height:13.9pt;background-color:transparent" valign="top" width="71">
<p style="margin:0cm 0cm 0pt;line-height:normal"><font color="#000000" face="Calibri">ART 10</font></p>
</td>
</tr>
<tr style="height:13.9pt">
<td style="border-width:0px 1pt 1pt;border-style:none solid solid;border-color:rgb(0,0,0) windowtext windowtext;padding:0cm 5.4pt;width:53pt;height:13.9pt;background-color:transparent" valign="top" width="71">
<p style="margin:0cm 0cm 0pt;line-height:normal"><font color="#000000" face="Calibri">ART 121</font></p>
</td>
<td style="border-width:0px 1pt 1pt 0px;border-style:none solid solid none;border-color:rgb(0,0,0) windowtext windowtext rgb(0,0,0);padding:0cm 5.4pt;width:53pt;height:13.9pt;background-color:transparent" valign="top" width="71">
<p style="margin:0cm 0cm 0pt;line-height:normal"><font color="#000000" face="Calibri">ART 15</font></p>
</td>
<td style="border-width:0px 1pt 1pt 0px;border-style:none solid solid none;border-color:rgb(0,0,0) windowtext windowtext rgb(0,0,0);padding:0cm 5.4pt;width:53pt;height:13.9pt;background-color:transparent" valign="top" width="71">
<p style="margin:0cm 0cm 0pt;line-height:normal"><font color="#000000" face="Calibri">ART 155</font></p>
</td>
</tr>
<tr style="height:13.9pt">
<td style="border-width:0px 1pt 1pt;border-style:none solid solid;border-color:rgb(0,0,0) windowtext windowtext;padding:0cm 5.4pt;width:53pt;height:13.9pt;background-color:transparent" valign="top" width="71">
<p style="margin:0cm 0cm 0pt;line-height:normal"><font color="#000000" face="Calibri">ART 155</font></p>
</td>
<td style="border-width:0px 1pt 1pt 0px;border-style:none solid solid none;border-color:rgb(0,0,0) windowtext windowtext rgb(0,0,0);padding:0cm 5.4pt;width:53pt;height:13.9pt;background-color:transparent" valign="top" width="71">
<p style="margin:0cm 0cm 0pt;line-height:normal"><font color="#000000" face="Calibri">ART 33</font></p>
</td>
<td style="border-width:0px 1pt 1pt 0px;border-style:none solid solid none;border-color:rgb(0,0,0) windowtext windowtext rgb(0,0,0);padding:0cm 5.4pt;width:53pt;height:13.9pt;background-color:transparent" valign="top" width="71">
<p style="margin:0cm 0cm 0pt;line-height:normal"><font color="#000000" face="Calibri">ART 121</font></p>
</td>
</tr>
<tr style="height:13.9pt">
<td style="border-width:0px 1pt 1pt;border-style:none solid solid;border-color:rgb(0,0,0) windowtext windowtext;padding:0cm 5.4pt;width:53pt;height:13.9pt;background-color:transparent" valign="top" width="71">
<p style="margin:0cm 0cm 0pt;line-height:normal"><font color="#000000" face="Calibri">ART 28</font></p>
</td>
<td style="border-width:0px 1pt 1pt 0px;border-style:none solid solid none;border-color:rgb(0,0,0) windowtext windowtext rgb(0,0,0);padding:0cm 5.4pt;width:53pt;height:13.9pt;background-color:transparent" valign="top" width="71">
<p style="margin:0cm 0cm 0pt;line-height:normal"><font color="#000000" face="Calibri">ART 33</font></p>
</td>
<td style="border-width:0px 1pt 1pt 0px;border-style:none solid solid none;border-color:rgb(0,0,0) windowtext windowtext rgb(0,0,0);padding:0cm 5.4pt;width:53pt;height:13.9pt;background-color:transparent" valign="top" width="71">
<p style="margin:0cm 0cm 0pt;line-height:normal"><font color="#000000" face="Calibri">ART 33</font></p>
</td>
</tr>
<tr style="height:13.9pt">
<td style="border-width:0px 1pt 1pt;border-style:none solid solid;border-color:rgb(0,0,0) windowtext windowtext;padding:0cm 5.4pt;width:53pt;height:13.9pt;background-color:transparent" valign="top" width="71">
<p style="margin:0cm 0cm 0pt;line-height:normal"><font color="#000000" face="Calibri">ART 121</font></p>
</td>
<td style="border-width:0px 1pt 1pt 0px;border-style:none solid solid none;border-color:rgb(0,0,0) windowtext windowtext rgb(0,0,0);padding:0cm 5.4pt;width:53pt;height:13.9pt;background-color:transparent" valign="top" width="71">
<p style="margin:0cm 0cm 0pt;line-height:normal"><font color="#000000" face="Calibri">ART 121</font></p>
</td>
<td style="border-width:0px 1pt 1pt 0px;border-style:none solid solid none;border-color:rgb(0,0,0) windowtext windowtext rgb(0,0,0);padding:0cm 5.4pt;width:53pt;height:13.9pt;background-color:transparent" valign="top" width="71">
<p style="margin:0cm 0cm 0pt;line-height:normal"><font color="#000000" face="Calibri">ART 121</font></p>
</td>
</tr>
<tr style="height:13.9pt">
<td style="border-width:0px 1pt 1pt;border-style:none solid solid;border-color:rgb(0,0,0) windowtext windowtext;padding:0cm 5.4pt;width:53pt;height:13.9pt;background-color:transparent" valign="top" width="71">
<p style="margin:0cm 0cm 0pt;line-height:normal"><font color="#000000" face="Calibri">ART 15</font></p>
</td>
<td style="border-width:0px 1pt 1pt 0px;border-style:none solid solid none;border-color:rgb(0,0,0) windowtext windowtext rgb(0,0,0);padding:0cm 5.4pt;width:53pt;height:13.9pt;background-color:transparent" valign="top" width="71">
<p style="margin:0cm 0cm 0pt;line-height:normal"><font color="#000000" face="Calibri">ART 121</font></p>
</td>
<td style="border-width:0px 1pt 1pt 0px;border-style:none solid solid none;border-color:rgb(0,0,0) windowtext windowtext rgb(0,0,0);padding:0cm 5.4pt;width:53pt;height:13.9pt;background-color:transparent" valign="top" width="71">
<p style="margin:0cm 0cm 0pt;line-height:normal"><font color="#000000" face="Calibri">ART 180</font></p>
</td>
</tr>
</tbody>
</table>
</div>
<div><br>
</div>
<div><br>
</div>
<div>a) Preciso contar cada elemento em cada variável, para que
vislumbre o seguinte resultado:</div>
<div><br>
</div>
<div><span style="font-size:14pt"><font color="#000000" face="Calibri"><b>ATO_1</b></font></span></div>
<div><br>
</div>
<div>ART 121 = 3</div>
<div>ART 33 = 1</div>
<div>ART 155= 1</div>
<div>ART 28= 1</div>
<div>ART 15 = 1</div>
<div><br>
</div>
<div>e assim com <span style="font-size:14pt"><font color="#000000" face="Calibri"><b>ATO_2 e </b><span style="font-size:14pt"><font color="#000000" face="Calibri"><b>ATO_3.</b></font></span></font></span></div>
<div><br>
</div>
<div>b) preciso saber o total de cada elemento em todos as
colunas, assim:</div>
<div><br>
</div>
<div>
<div>ART 121 = 7</div>
<div>ART 33 = 4</div>
<div>ART 155= 3</div>
<div>ART 28= 2</div>
<div>ART 15 = 2</div>
<div>ART 180=2</div>
<div>ART 10=1</div>
<div><br>
</div>
<div>Muito obrigado.</div>
</div>
<div><br>
</div>
</div>
<br>
<fieldset></fieldset>
<br>
</div></div><pre><span class="">_______________________________________________
R-br mailing list
<a href="mailto:R-br@listas.c3sl.ufpr.br" target="_blank">R-br@listas.c3sl.ufpr.br</a>
<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></span>
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.</pre>
</blockquote>
<br>
</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" rel="noreferrer" 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="noreferrer" 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>