<div dir="ltr"><div>Ei Eder!</div><div><br></div><div>Segui sua ideia, porque foi a que mais entendi, mas retorna o seguinte erro:</div><div><table style="outline:invert;border:medium;width:1009px;color:rgb(0,0,0);text-transform:none;line-height:inherit!important;text-indent:0px;letter-spacing:normal;padding-bottom:8px;padding-left:6px;font-family:"Lucida Console"!important;font-size:10pt!important;font-style:inherit!important;font-variant:inherit!important;font-weight:inherit!important;word-spacing:0px;white-space:pre-wrap!important;word-wrap:break-word;background-color:rgb(255,255,255)" cellspacing="0" cellpadding="0"><tbody><tr><td align="left" style="line-height:1.2;font-family:"Lucida Console";font-size:10pt!important;vertical-align:top"><pre tabindex="0" id="rstudio_console_output" style="margin:0px;outline:invert;border:medium;line-height:1.2;font-family:"Lucida Console";font-size:10pt!important;white-space:pre-wrap!important"><span style="color:blue;white-space:pre"><br></span></pre><pre tabindex="0" style="margin:0px;outline:invert;border:medium;line-height:1.2;font-family:"Lucida Console";font-size:10pt!important;white-space:pre-wrap!important"><span style="color:blue;white-space:pre">> </span><span style="color:blue">addmargins(tab)
</span><span style="color:rgb(197,6,11)">Error in addmargins(tab) : 'A' deve ser um array ou tabela
</span></pre></td></tr><tr><td align="left" style="line-height:1.2;font-family:"Lucida Console";font-size:10pt!important;vertical-align:top"></td></tr><tr><td align="left" style="line-height:1.2;font-family:"Lucida Console";font-size:10pt!important;vertical-align:top"><table style="width:1009px" cellspacing="0" cellpadding="0"><tbody><tr><td width="1" height="" align="left" style="line-height:1.2;font-family:"Lucida Console";font-size:10pt!important;vertical-align:top" rowspan="1"><div style="color:blue;white-space:pre">> </div></td></tr></tbody></table></td></tr></tbody></table></div><div><br></div><div>Aproveito para agradecer a ajuda de todos</div><div>.</div><div>Elerson</div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">Em 27 de maio de 2016 17:33, Éder Comunello <span dir="ltr"><<a href="mailto:comunello.eder@gmail.com" target="_blank">comunello.eder@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 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"><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 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"><div><div class="h5">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></div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div class="h5">
<div text="#000000" bgcolor="#FFFFFF">
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><br>
<br>
<div>Em 26/05/2016 16:28, Amiko Bh escreveu:<br>
</div>
</div></div><blockquote type="cite"><div><div>
<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" border="1" cellspacing="0" cellpadding="0">
<tbody>
<tr style="height:14.3pt">
<td width="71" valign="top" style="padding:0cm 5.4pt;border:1pt solid windowtext;width:53pt;height:14.3pt;background-color:transparent">
<p align="center" style="margin:0cm 0cm 0pt;text-align:center;line-height:normal"><b><span style="font-size:14pt"><font color="#000000" face="Calibri">ATO_1</font></span></b></p>
</td>
<td width="71" valign="top" 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">
<p align="center" style="margin:0cm 0cm 0pt;text-align:center;line-height:normal"><b><span style="font-size:14pt"><font color="#000000" face="Calibri">ATO_2</font></span></b></p>
</td>
<td width="71" valign="top" 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">
<p align="center" style="margin:0cm 0cm 0pt;text-align:center;line-height:normal"><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 width="71" valign="top" 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">
<p style="margin:0cm 0cm 0pt;line-height:normal"><font color="#000000" face="Calibri">ART 121</font></p>
</td>
<td width="71" valign="top" 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">
<p style="margin:0cm 0cm 0pt;line-height:normal"><font color="#000000" face="Calibri">ART 155</font></p>
</td>
<td width="71" valign="top" 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">
<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 width="71" valign="top" 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">
<p style="margin:0cm 0cm 0pt;line-height:normal"><font color="#000000" face="Calibri">ART 33</font></p>
</td>
<td width="71" valign="top" 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">
<p style="margin:0cm 0cm 0pt;line-height:normal"><font color="#000000" face="Calibri">ART 28</font></p>
</td>
<td width="71" valign="top" 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">
<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 width="71" valign="top" 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">
<p style="margin:0cm 0cm 0pt;line-height:normal"><font color="#000000" face="Calibri">ART 121</font></p>
</td>
<td width="71" valign="top" 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">
<p style="margin:0cm 0cm 0pt;line-height:normal"><font color="#000000" face="Calibri">ART 15</font></p>
</td>
<td width="71" valign="top" 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">
<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 width="71" valign="top" 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">
<p style="margin:0cm 0cm 0pt;line-height:normal"><font color="#000000" face="Calibri">ART 155</font></p>
</td>
<td width="71" valign="top" 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">
<p style="margin:0cm 0cm 0pt;line-height:normal"><font color="#000000" face="Calibri">ART 33</font></p>
</td>
<td width="71" valign="top" 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">
<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 width="71" valign="top" 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">
<p style="margin:0cm 0cm 0pt;line-height:normal"><font color="#000000" face="Calibri">ART 28</font></p>
</td>
<td width="71" valign="top" 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">
<p style="margin:0cm 0cm 0pt;line-height:normal"><font color="#000000" face="Calibri">ART 33</font></p>
</td>
<td width="71" valign="top" 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">
<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 width="71" valign="top" 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">
<p style="margin:0cm 0cm 0pt;line-height:normal"><font color="#000000" face="Calibri">ART 121</font></p>
</td>
<td width="71" valign="top" 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">
<p style="margin:0cm 0cm 0pt;line-height:normal"><font color="#000000" face="Calibri">ART 121</font></p>
</td>
<td width="71" valign="top" 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">
<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 width="71" valign="top" 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">
<p style="margin:0cm 0cm 0pt;line-height:normal"><font color="#000000" face="Calibri">ART 15</font></p>
</td>
<td width="71" valign="top" 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">
<p style="margin:0cm 0cm 0pt;line-height:normal"><font color="#000000" face="Calibri">ART 121</font></p>
</td>
<td width="71" valign="top" 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">
<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>_______________________________________________
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" target="_blank">R-br@listas.c3sl.ufpr.br</a><br>
<a href="https://listas.inf.ufpr.br/cgi-bin/mailman/listinfo/r-br" target="_blank" rel="noreferrer">https://listas.inf.ufpr.br/cgi-bin/mailman/listinfo/r-br</a><br></div></div>
Leia o guia de postagem (<a href="http://www.leg.ufpr.br/r-br-guia" target="_blank" rel="noreferrer">http://www.leg.ufpr.br/r-br-guia</a>) e forneça código mínimo reproduzível.<br></blockquote></div><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" target="_blank" rel="noreferrer">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" rel="noreferrer">http://www.leg.ufpr.br/r-br-guia</a>) e forneça código mínimo reproduzível.<br></blockquote></div><br></div>