<div dir="ltr">Alexandre,<div><br></div><div>Segue uma solução: aggregate(sp[c(F, F, T)], by = list(Ano = sp$ano), sum)</div></div><div class="gmail_extra"><br><br><div class="gmail_quote">2014-04-08 21:45 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">
Rodrigo, é porque exclui as colunas referentes ao mês e ano. Mas
segue abaixo a saída considerando essas duas colunas.<br>
<br>
Com relação a quantidade de zeros, é porque na base já aparece todos
os meses para 2014 (jan, fev, mar, abr, ..., dez), todavia, só há
informações para janeiro e fevereiro. <br>
<br>
Outro detalhe é que os anos estão na ordem decrescente, ou seja, as
primeiras linhas são para 2014 (e uma vez que pediu head está
aparecendo somente para esse ano).<br>
<br>
As outras duas sugestões enviadas estão reportando o somatório para
a coluna toda, mas não é isso o que preciso. Preciso do total para
cada ano, ou seja, terá de ter uma linha com o total para 1997,
outra linha para 1998 assim sucessivamente até a última linha para o
total de 2014. <br>
<br>
<br>
<br>
<br>
> dput(head(sp))<br>
structure(list(ano = c(2014L, 2014L, 2014L, 2014L, 2014L, 2014L<br>
), mes = structure(c(5L, 4L, 9L, 1L, 8L, 7L), .Label = c("ABR", <br>
"AGO", "DEZ", "FEV", "JAN", "JUL", "JUN", "MAI", "MAR", "NOV", <br>
"OUT", "SET"), class = "factor"), `US$` = c(38795229L, 63924605L, <br>
0L, 0L, 0L, 0L), ano = c(2014L, 2014L, 2014L, 2014L, 2014L, 2014L<br>
), mes = structure(c(5L, 4L, 9L, 1L, 8L, 7L), .Label = c("ABR", <br>
"AGO", "DEZ", "FEV", "JAN", "JUL", "JUN", "MAI", "MAR", "NOV", <br>
"OUT", "SET"), class = "factor"), `US$` = c(33680798L, 51477786L, <br>
0L, 0L, 0L, 0L), ano = c(2014L, 2014L, 2014L, 2014L, 2014L, 2014L<br>
), mes = structure(c(5L, 4L, 9L, 1L, 8L, 7L), .Label = c("ABR", <br>
"AGO", "DEZ", "FEV", "JAN", "JUL", "JUN", "MAI", "MAR", "NOV", <br>
"OUT", "SET"), class = "factor"), `US$` = c(32400472L, 39645654L, <br>
0L, 0L, 0L, 0L), ano = c(2014L, 2014L, 2014L, 2014L, 2014L, 2014L<br>
), mes = structure(c(5L, 4L, 9L, 1L, 8L, 7L), .Label = c("ABR", <br>
"AGO", "DEZ", "FEV", "JAN", "JUL", "JUN", "MAI", "MAR", "NOV", <br>
"OUT", "SET"), class = "factor"), `US$` = c(68022854L, 56066200L, <br>
0L, 0L, 0L, 0L), ano = c(2014L, 2014L, 2014L, 2014L, 2014L, 2014L<br>
), mes = structure(c(5L, 4L, 9L, 1L, 8L, 7L), .Label = c("ABR", <br>
"AGO", "DEZ", "FEV", "JAN", "JUL", "JUN", "MAI", "MAR", "NOV", <br>
"OUT", "SET"), class = "factor"), `US$` = c(31881633L, 67045744L, <br>
0L, 0L, 0L, 0L), ano = c(2014L, 2014L, 2014L, 2014L, 2014L, 2014L<br>
), mes = structure(c(5L, 4L, 9L, 1L, 8L, 7L), .Label = c("ABR", <br>
"AGO", "DEZ", "FEV", "JAN", "JUL", "JUN", "MAI", "MAR", "NOV", <br>
"OUT", "SET"), class = "factor"), `US$` = c(452118806L, 500158705L,
<br>
0L, 0L, 0L, 0L), ano = c(2014L, 2014L, 2014L, 2014L, 2014L, 2014L<br>
), mes = structure(c(5L, 4L, 9L, 1L, 8L, 7L), .Label = c("ABR", <br>
"AGO", "DEZ", "FEV", "JAN", "JUL", "JUN", "MAI", "MAR", "NOV", <br>
"OUT", "SET"), class = "factor"), `US$` = c(21795038L, 13562364L, <br>
0L, 0L, 0L, 0L), ano = c(2014L, 2014L, 2014L, 2014L, 2014L, 2014L<br>
), mes = structure(c(5L, 4L, 9L, 1L, 8L, 7L), .Label = c("ABR", <br>
"AGO", "DEZ", "FEV", "JAN", "JUL", "JUN", "MAI", "MAR", "NOV", <br>
"OUT", "SET"), class = "factor"), `US$` = c(2730838L, 4259594L, <br>
0L, 0L, 0L, 0L), ano = c(2014L, 2014L, 2014L, 2014L, 2014L, 2014L<br>
), mes = structure(c(5L, 4L, 9L, 1L, 8L, 7L), .Label = c("ABR", <br>
"AGO", "DEZ", "FEV", "JAN", "JUL", "JUN", "MAI", "MAR", "NOV", <br>
"OUT", "SET"), class = "factor"), `US$` = c(103132447L, 85622631L, <br>
0L, 0L, 0L, 0L), ano = c(2014L, 2014L, 2014L, 2014L, 2014L, 2014L<br>
), mes = structure(c(5L, 4L, 9L, 1L, 8L, 7L), .Label = c("ABR", <br>
"AGO", "DEZ", "FEV", "JAN", "JUL", "JUN", "MAI", "MAR", "NOV", <br>
"OUT", "SET"), class = "factor"), `US$` = c(60353896L, 61121454L, <br>
0L, 0L, 0L, 0L), ano = c(2014L, 2014L, 2014L, 2014L, 2014L, 2014L<br>
), mes = structure(c(5L, 4L, 9L, 1L, 8L, 7L), .Label = c("ABR", <br>
"AGO", "DEZ", "FEV", "JAN", "JUL", "JUN", "MAI", "MAR", "NOV", <br>
"OUT", "SET"), class = "factor"), `US$` = c(32403301L, 40519152L, <br>
0L, 0L, 0L, 0L), ano = c(2014L, 2014L, 2014L, 2014L, 2014L, 2014L<br>
), mes = structure(c(5L, 4L, 9L, 1L, 8L, 7L), .Label = c("ABR", <br>
"AGO", "DEZ", "FEV", "JAN", "JUL", "JUN", "MAI", "MAR", "NOV", <br>
"OUT", "SET"), class = "factor"), `US$` = c(116570336L, 110079499L,
<br>
0L, 0L, 0L, 0L), ano = c(2014L, 2014L, 2014L, 2014L, 2014L, 2014L<br>
), mes = structure(c(5L, 4L, 9L, 1L, 8L, 7L), .Label = c("ABR", <br>
"AGO", "DEZ", "FEV", "JAN", "JUL", "JUN", "MAI", "MAR", "NOV", <br>
"OUT", "SET"), class = "factor"), `US$` = c(166832925L, 149309546L,
<br>
0L, 0L, 0L, 0L), ano = c(2014L, 2014L, 2014L, 2014L, 2014L, 2014L<br>
), mes = structure(c(5L, 4L, 9L, 1L, 8L, 7L), .Label = c("ABR", <br>
"AGO", "DEZ", "FEV", "JAN", "JUL", "JUN", "MAI", "MAR", "NOV", <br>
"OUT", "SET"), class = "factor"), `US$` = c(78060254L, 101650482L, <br>
0L, 0L, 0L, 0L), ano = c(2014L, 2014L, 2014L, 2014L, 2014L, 2014L<br>
), mes = structure(c(5L, 4L, 9L, 1L, 8L, 7L), .Label = c("ABR", <br>
"AGO", "DEZ", "FEV", "JAN", "JUL", "JUN", "MAI", "MAR", "NOV", <br>
"OUT", "SET"), class = "factor"), `US$` = c(25985390L, 36699369L, <br>
0L, 0L, 0L, 0L), ano = c(2014L, 2014L, 2014L, 2014L, 2014L, 2014L<br>
), mes = structure(c(5L, 4L, 9L, 1L, 8L, 7L), .Label = c("ABR", <br>
"AGO", "DEZ", "FEV", "JAN", "JUL", "JUN", "MAI", "MAR", "NOV", <br>
"OUT", "SET"), class = "factor"), `US$` = c(69222831L, 80306324L, <br>
0L, 0L, 0L, 0L), ano = c(2014L, 2014L, 2014L, 2014L, 2014L, 2014L<br>
), mes = structure(c(5L, 4L, 9L, 1L, 8L, 7L), .Label = c("ABR", <br>
"AGO", "DEZ", "FEV", "JAN", "JUL", "JUN", "MAI", "MAR", "NOV", <br>
"OUT", "SET"), class = "factor"), `US$` = c(4392027L, 4567085L, <br>
0L, 0L, 0L, 0L), ano = c(2014L, 2014L, 2014L, 2014L, 2014L, 2014L<br>
), mes = structure(c(5L, 4L, 9L, 1L, 8L, 7L), .Label = c("ABR", <br>
"AGO", "DEZ", "FEV", "JAN", "JUL", "JUN", "MAI", "MAR", "NOV", <br>
"OUT", "SET"), class = "factor"), `US$` = c(33752865L, 41537988L, <br>
0L, 0L, 0L, 0L), ano = c(2014L, 2014L, 2014L, 2014L, 2014L, 2014L<br>
), mes = structure(c(5L, 4L, 9L, 1L, 8L, 7L), .Label = c("ABR", <br>
"AGO", "DEZ", "FEV", "JAN", "JUL", "JUN", "MAI", "MAR", "NOV", <br>
"OUT", "SET"), class = "factor"), `US$` = c(80216802L, 88982746L, <br>
0L, 0L, 0L, 0L), ano = c(2014L, 2014L, 2014L, 2014L, 2014L, 2014L<br>
), mes = structure(c(5L, 4L, 9L, 1L, 8L, 7L), .Label = c("ABR", <br>
"AGO", "DEZ", "FEV", "JAN", "JUL", "JUN", "MAI", "MAR", "NOV", <br>
"OUT", "SET"), class = "factor"), `US$` = c(1489612L, 1465175L, <br>
0L, 0L, 0L, 0L), ano = c(2014L, 2014L, 2014L, 2014L, 2014L, 2014L<br>
), mes = structure(c(5L, 4L, 9L, 1L, 8L, 7L), .Label = c("ABR", <br>
"AGO", "DEZ", "FEV", "JAN", "JUL", "JUN", "MAI", "MAR", "NOV", <br>
"OUT", "SET"), class = "factor"), `US$` = c(60973115L, 54078115L, <br>
0L, 0L, 0L, 0L), ano = c(2014L, 2014L, 2014L, 2014L, 2014L, 2014L<br>
), mes = structure(c(5L, 4L, 9L, 1L, 8L, 7L), .Label = c("ABR", <br>
"AGO", "DEZ", "FEV", "JAN", "JUL", "JUN", "MAI", "MAR", "NOV", <br>
"OUT", "SET"), class = "factor"), `US$` = c(28441802L, 50033001L, <br>
0L, 0L, 0L, 0L), ano = c(2014L, 2014L, 2014L, 2014L, 2014L, 2014L<br>
), mes = structure(c(5L, 4L, 9L, 1L, 8L, 7L), .Label = c("ABR", <br>
"AGO", "DEZ", "FEV", "JAN", "JUL", "JUN", "MAI", "MAR", "NOV", <br>
"OUT", "SET"), class = "factor"), `US$` = c(60420736L, 17987780L, <br>
0L, 0L, 0L, 0L), ano = c(2014L, 2014L, 2014L, 2014L, 2014L, 2014L<br>
), mes = structure(c(5L, 4L, 9L, 1L, 8L, 7L), .Label = c("ABR", <br>
"AGO", "DEZ", "FEV", "JAN", "JUL", "JUN", "MAI", "MAR", "NOV", <br>
"OUT", "SET"), class = "factor"), `US$` = c(28824716L, 48507914L, <br>
0L, 0L, 0L, 0L), ano = c(2014L, 2014L, 2014L, 2014L, 2014L, 2014L<br>
), mes = structure(c(5L, 4L, 9L, 1L, 8L, 7L), .Label = c("ABR", <br>
"AGO", "DEZ", "FEV", "JAN", "JUL", "JUN", "MAI", "MAR", "NOV", <br>
"OUT", "SET"), class = "factor"), `US$` = c(444712L, 328451L, <br>
0L, 0L, 0L, 0L), ano = c(2014L, 2014L, 2014L, 2014L, 2014L, 2014L<br>
), mes = structure(c(5L, 4L, 9L, 1L, 8L, 7L), .Label = c("ABR", <br>
"AGO", "DEZ", "FEV", "JAN", "JUL", "JUN", "MAI", "MAR", "NOV", <br>
"OUT", "SET"), class = "factor"), `US$` = c(786654L, 838397L, <br>
0L, 0L, 0L, 0L), ano = c(2014L, 2014L, 2014L, 2014L, 2014L, 2014L<br>
), mes = structure(c(5L, 4L, 9L, 1L, 8L, 7L), .Label = c("ABR", <br>
"AGO", "DEZ", "FEV", "JAN", "JUL", "JUN", "MAI", "MAR", "NOV", <br>
"OUT", "SET"), class = "factor"), `US$` = c(12933000L, 10051098L, <br>
0L, 0L, 0L, 0L), ano = c(2014L, 2014L, 2014L, 2014L, 2014L, 2014L<br>
), mes = structure(c(5L, 4L, 9L, 1L, 8L, 7L), .Label = c("ABR", <br>
"AGO", "DEZ", "FEV", "JAN", "JUL", "JUN", "MAI", "MAR", "NOV", <br>
"OUT", "SET"), class = "factor"), `US$` = c(39827569L, 45256447L, <br>
0L, 0L, 0L, 0L), ano = c(2014L, 2014L, 2014L, 2014L, 2014L, 2014L<br>
), mes = structure(c(5L, 4L, 9L, 1L, 8L, 7L), .Label = c("ABR", <br>
"AGO", "DEZ", "FEV", "JAN", "JUL", "JUN", "MAI", "MAR", "NOV", <br>
"OUT", "SET"), class = "factor"), `US$` = c(58803226L, 76290276L, <br>
0L, 0L, 0L, 0L), ano = c(2014L, 2014L, 2014L, 2014L, 2014L, 2014L<br>
), mes = structure(c(5L, 4L, 9L, 1L, 8L, 7L), .Label = c("ABR", <br>
"AGO", "DEZ", "FEV", "JAN", "JUL", "JUN", "MAI", "MAR", "NOV", <br>
"OUT", "SET"), class = "factor"), `US$` = c(46468076L, 38537192L, <br>
0L, 0L, 0L, 0L), ano = c(2014L, 2014L, 2014L, 2014L, 2014L, 2014L<br>
), mes = structure(c(5L, 4L, 9L, 1L, 8L, 7L), .Label = c("ABR", <br>
"AGO", "DEZ", "FEV", "JAN", "JUL", "JUN", "MAI", "MAR", "NOV", <br>
"OUT", "SET"), class = "factor"), `US$` = c(53314093L, 33200142L, <br>
0L, 0L, 0L, 0L), ano = c(2014L, 2014L, 2014L, 2014L, 2014L, 2014L<br>
), mes = structure(c(5L, 4L, 9L, 1L, 8L, 7L), .Label = c("ABR", <br>
"AGO", "DEZ", "FEV", "JAN", "JUL", "JUN", "MAI", "MAR", "NOV", <br>
"OUT", "SET"), class = "factor"), `US$` = c(34642085L, 23556561L, <br>
0L, 0L, 0L, 0L), ano = c(2014L, 2014L, 2014L, 2014L, 2014L, 2014L<br>
), mes = structure(c(5L, 4L, 9L, 1L, 8L, 7L), .Label = c("ABR", <br>
"AGO", "DEZ", "FEV", "JAN", "JUL", "JUN", "MAI", "MAR", "NOV", <br>
"OUT", "SET"), class = "factor"), `US$` = c(119213241L, 121005345L,
<br>
0L, 0L, 0L, 0L), ano = c(2014L, 2014L, 2014L, 2014L, 2014L, 2014L<br>
), mes = structure(c(5L, 4L, 9L, 1L, 8L, 7L), .Label = c("ABR", <br>
"AGO", "DEZ", "FEV", "JAN", "JUL", "JUN", "MAI", "MAR", "NOV", <br>
"OUT", "SET"), class = "factor"), `US$` = c(274982262L, 244713051L,
<br>
0L, 0L, 0L, 0L), ano = c(2014L, 2014L, 2014L, 2014L, 2014L, 2014L<br>
), mes = structure(c(5L, 4L, 9L, 1L, 8L, 7L), .Label = c("ABR", <br>
"AGO", "DEZ", "FEV", "JAN", "JUL", "JUN", "MAI", "MAR", "NOV", <br>
"OUT", "SET"), class = "factor"), `US$` = c(74376824L, 35888744L, <br>
0L, 0L, 0L, 0L), ano = c(2014L, 2014L, 2014L, 2014L, 2014L, 2014L<br>
), mes = structure(c(5L, 4L, 9L, 1L, 8L, 7L), .Label = c("ABR", <br>
"AGO", "DEZ", "FEV", "JAN", "JUL", "JUN", "MAI", "MAR", "NOV", <br>
"OUT", "SET"), class = "factor"), `US$` = c(2144991L, 2440378L, <br>
0L, 0L, 0L, 0L), ano = c(2014L, 2014L, 2014L, 2014L, 2014L, 2014L<br>
), mes = structure(c(5L, 4L, 9L, 1L, 8L, 7L), .Label = c("ABR", <br>
"AGO", "DEZ", "FEV", "JAN", "JUL", "JUN", "MAI", "MAR", "NOV", <br>
"OUT", "SET"), class = "factor"), `US$` = c(114384520L, 74615518L, <br>
0L, 0L, 0L, 0L), ano = c(2014L, 2014L, 2014L, 2014L, 2014L, 2014L<br>
), mes = structure(c(5L, 4L, 9L, 1L, 8L, 7L), .Label = c("ABR", <br>
"AGO", "DEZ", "FEV", "JAN", "JUL", "JUN", "MAI", "MAR", "NOV", <br>
"OUT", "SET"), class = "factor"), `US$` = c(54130383L, 62022477L, <br>
0L, 0L, 0L, 0L), ano = c(2014L, 2014L, 2014L, 2014L, 2014L, 2014L<br>
), mes = structure(c(5L, 4L, 9L, 1L, 8L, 7L), .Label = c("ABR", <br>
"AGO", "DEZ", "FEV", "JAN", "JUL", "JUN", "MAI", "MAR", "NOV", <br>
"OUT", "SET"), class = "factor"), `US$` = c(3340357L, 4785296L, <br>
0L, 0L, 0L, 0L), ano = c(2014L, 2014L, 2014L, 2014L, 2014L, 2014L<br>
), mes = structure(c(5L, 4L, 9L, 1L, 8L, 7L), .Label = c("ABR", <br>
"AGO", "DEZ", "FEV", "JAN", "JUL", "JUN", "MAI", "MAR", "NOV", <br>
"OUT", "SET"), class = "factor"), `US$` = c(3396350L, 3538952L, <br>
0L, 0L, 0L, 0L), ano = c(2014L, 2014L, 2014L, 2014L, 2014L, 2014L<br>
), mes = structure(c(5L, 4L, 9L, 1L, 8L, 7L), .Label = c("ABR", <br>
"AGO", "DEZ", "FEV", "JAN", "JUL", "JUN", "MAI", "MAR", "NOV", <br>
"OUT", "SET"), class = "factor"), `US$` = c(7356480L, 6493192L, <br>
0L, 0L, 0L, 0L), ano = c(2014L, 2014L, 2014L, 2014L, 2014L, 2014L<br>
), mes = structure(c(5L, 4L, 9L, 1L, 8L, 7L), .Label = c("ABR", <br>
"AGO", "DEZ", "FEV", "JAN", "JUL", "JUN", "MAI", "MAR", "NOV", <br>
"OUT", "SET"), class = "factor"), `US$` = c(30067652L, 34811828L, <br>
0L, 0L, 0L, 0L), ano = c(2014L, 2014L, 2014L, 2014L, 2014L, 2014L<br>
), mes = structure(c(5L, 4L, 9L, 1L, 8L, 7L), .Label = c("ABR", <br>
"AGO", "DEZ", "FEV", "JAN", "JUL", "JUN", "MAI", "MAR", "NOV", <br>
"OUT", "SET"), class = "factor"), `US$` = c(10236714L, 14744233L, <br>
0L, 0L, 0L, 0L), ano = c(2014L, 2014L, 2014L, 2014L, 2014L, 2014L<br>
), mes = structure(c(5L, 4L, 9L, 1L, 8L, 7L), .Label = c("ABR", <br>
"AGO", "DEZ", "FEV", "JAN", "JUL", "JUN", "MAI", "MAR", "NOV", <br>
"OUT", "SET"), class = "factor"), `US$` = c(21064904L, 28239710L, <br>
0L, 0L, 0L, 0L), ano = c(2014L, 2014L, 2014L, 2014L, 2014L, 2014L<br>
), mes = structure(c(5L, 4L, 9L, 1L, 8L, 7L), .Label = c("ABR", <br>
"AGO", "DEZ", "FEV", "JAN", "JUL", "JUN", "MAI", "MAR", "NOV", <br>
"OUT", "SET"), class = "factor"), `US$` = c(5987416L, 9771117L, <br>
0L, 0L, 0L, 0L), ano = c(2014L, 2014L, 2014L, 2014L, 2014L, 2014L<br>
), mes = structure(c(5L, 4L, 9L, 1L, 8L, 7L), .Label = c("ABR", <br>
"AGO", "DEZ", "FEV", "JAN", "JUL", "JUN", "MAI", "MAR", "NOV", <br>
"OUT", "SET"), class = "factor"), `US$` = c(16779486L, 11925052L, <br>
0L, 0L, 0L, 0L), ano = c(2014L, 2014L, 2014L, 2014L, 2014L, 2014L<br>
), mes = structure(c(5L, 4L, 9L, 1L, 8L, 7L), .Label = c("ABR", <br>
"AGO", "DEZ", "FEV", "JAN", "JUL", "JUN", "MAI", "MAR", "NOV", <br>
"OUT", "SET"), class = "factor"), `US$` = c(9060866L, 13985017L, <br>
0L, 0L, 0L, 0L), ano = c(2014L, 2014L, 2014L, 2014L, 2014L, 2014L<br>
), mes = structure(c(5L, 4L, 9L, 1L, 8L, 7L), .Label = c("ABR", <br>
"AGO", "DEZ", "FEV", "JAN", "JUL", "JUN", "MAI", "MAR", "NOV", <br>
"OUT", "SET"), class = "factor"), `US$` = c(15448503L, 24449350L, <br>
0L, 0L, 0L, 0L), ano = c(2014L, 2014L, 2014L, 2014L, 2014L, 2014L<br>
), mes = structure(c(5L, 4L, 9L, 1L, 8L, 7L), .Label = c("ABR", <br>
"AGO", "DEZ", "FEV", "JAN", "JUL", "JUN", "MAI", "MAR", "NOV", <br>
"OUT", "SET"), class = "factor"), `US$` = c(8407209L, 20023742L, <br>
0L, 0L, 0L, 0L), ano = c(2014L, 2014L, 2014L, 2014L, 2014L, 2014L<br>
), mes = structure(c(5L, 4L, 9L, 1L, 8L, 7L), .Label = c("ABR", <br>
"AGO", "DEZ", "FEV", "JAN", "JUL", "JUN", "MAI", "MAR", "NOV", <br>
"OUT", "SET"), class = "factor"), `US$` = c(38288341L, 43777071L, <br>
0L, 0L, 0L, 0L), ano = c(2014L, 2014L, 2014L, 2014L, 2014L, 2014L<br>
), mes = structure(c(5L, 4L, 9L, 1L, 8L, 7L), .Label = c("ABR", <br>
"AGO", "DEZ", "FEV", "JAN", "JUL", "JUN", "MAI", "MAR", "NOV", <br>
"OUT", "SET"), class = "factor"), `US$` = c(610282312L, 508090709L,
<br>
0L, 0L, 0L, 0L)), .Names = c("ano", "mes", "US$", "ano", "mes", <br>
"US$", "ano", "mes", "US$", "ano", "mes", "US$", "ano", "mes", <br>
"US$", "ano", "mes", "US$", "ano", "mes", "US$", "ano", "mes", <br>
"US$", "ano", "mes", "US$", "ano", "mes", "US$", "ano", "mes", <br>
"US$", "ano", "mes", "US$", "ano", "mes", "US$", "ano", "mes", <br>
"US$", "ano", "mes", "US$", "ano", "mes", "US$", "ano", "mes", <br>
"US$", "ano", "mes", "US$", "ano", "mes", "US$", "ano", "mes", <br>
"US$", "ano", "mes", "US$", "ano", "mes", "US$", "ano", "mes", <br>
"US$", "ano", "mes", "US$", "ano", "mes", "US$", "ano", "mes", <br>
"US$", "ano", "mes", "US$", "ano", "mes", "US$", "ano", "mes", <br>
"US$", "ano", "mes", "US$", "ano", "mes", "US$", "ano", "mes", <br>
"US$", "ano", "mes", "US$", "ano", "mes", "US$", "ano", "mes", <br>
"US$", "ano", "mes", "US$", "ano", "mes", "US$", "ano", "mes", <br>
"US$", "ano", "mes", "US$", "ano", "mes", "US$", "ano", "mes", <br>
"US$", "ano", "mes", "US$", "ano", "mes", "US$", "ano", "mes", <br>
"US$", "ano", "mes", "US$", "ano", "mes", "US$", "ano", "mes", <br>
"US$", "ano", "mes", "US$", "ano", "mes", "US$", "ano", "mes", <br>
"US$", "ano", "mes", "US$"), row.names = c(NA, 6L), class =
"data.frame")<br>
> <br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<div>Em 08-04-2014 21:13, Rodrigo Coster
escreveu:<br>
</div><div><div class="h5">
<blockquote type="cite">
<div dir="ltr">Era isso mesmo, mas eles pareceram meio estranho,
pois tem muita linha com 0... eu tava esperando mais uma coluna
informando o mes e ano e outras com as observações. Se os
comandos sugeridos aqui (que fazem a soma total da coluna) não
funcionarem, da uma explicada de como são os teus dados (a
estrutura deles) que a gente resolve!</div>
<div class="gmail_extra"><br>
<br>
<div class="gmail_quote">2014-04-08 20:37 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"> Olá Rodrigo Coster!<br>
<br>
<br>
É isto mesmo que você solicitou?<br>
<br>
<br>
<br>
> dput(head(sp))<br>
structure(c(38795229L, 63924605L, 0L, 0L, 0L, 0L,
33680798L, <br>
51477786L, 0L, 0L, 0L, 0L, 32400472L, 39645654L, 0L, 0L,
0L, <br>
0L, 68022854L, 56066200L, 0L, 0L, 0L, 0L, 31881633L,
67045744L, <br>
0L, 0L, 0L, 0L, 452118806L, 500158705L, 0L, 0L, 0L, 0L,
21795038L, <br>
13562364L, 0L, 0L, 0L, 0L, 2730838L, 4259594L, 0L, 0L, 0L,
0L, <br>
103132447L, 85622631L, 0L, 0L, 0L, 0L, 60353896L,
61121454L, <br>
0L, 0L, 0L, 0L, 32403301L, 40519152L, 0L, 0L, 0L, 0L,
116570336L, <br>
110079499L, 0L, 0L, 0L, 0L, 166832925L, 149309546L, 0L,
0L, 0L, <br>
0L, 78060254L, 101650482L, 0L, 0L, 0L, 0L, 25985390L,
36699369L, <br>
0L, 0L, 0L, 0L, 69222831L, 80306324L, 0L, 0L, 0L, 0L,
4392027L, <br>
4567085L, 0L, 0L, 0L, 0L, 33752865L, 41537988L, 0L, 0L,
0L, 0L, <br>
80216802L, 88982746L, 0L, 0L, 0L, 0L, 1489612L, 1465175L,
0L, <br>
0L, 0L, 0L, 60973115L, 54078115L, 0L, 0L, 0L, 0L,
28441802L, <br>
50033001L, 0L, 0L, 0L, 0L, 60420736L, 17987780L, 0L, 0L,
0L, <br>
0L, 28824716L, 48507914L, 0L, 0L, 0L, 0L, 444712L,
328451L, 0L, <br>
0L, 0L, 0L, 786654L, 838397L, 0L, 0L, 0L, 0L, 12933000L,
10051098L, <br>
0L, 0L, 0L, 0L, 39827569L, 45256447L, 0L, 0L, 0L, 0L,
58803226L, <br>
76290276L, 0L, 0L, 0L, 0L, 46468076L, 38537192L, 0L, 0L,
0L, <br>
0L, 53314093L, 33200142L, 0L, 0L, 0L, 0L, 34642085L,
23556561L, <br>
0L, 0L, 0L, 0L, 119213241L, 121005345L, 0L, 0L, 0L, 0L,
274982262L, <br>
244713051L, 0L, 0L, 0L, 0L, 74376824L, 35888744L, 0L, 0L,
0L, <br>
0L, 2144991L, 2440378L, 0L, 0L, 0L, 0L, 114384520L,
74615518L, <br>
0L, 0L, 0L, 0L, 54130383L, 62022477L, 0L, 0L, 0L, 0L,
3340357L, <br>
4785296L, 0L, 0L, 0L, 0L, 3396350L, 3538952L, 0L, 0L, 0L,
0L, <br>
7356480L, 6493192L, 0L, 0L, 0L, 0L, 30067652L, 34811828L,
0L, <br>
0L, 0L, 0L, 10236714L, 14744233L, 0L, 0L, 0L, 0L,
21064904L, <br>
28239710L, 0L, 0L, 0L, 0L, 5987416L, 9771117L, 0L, 0L, 0L,
0L, <br>
16779486L, 11925052L, 0L, 0L, 0L, 0L, 9060866L, 13985017L,
0L, <br>
0L, 0L, 0L, 15448503L, 24449350L, 0L, 0L, 0L, 0L,
8407209L, 20023742L, <br>
0L, 0L, 0L, 0L, 38288341L, 43777071L, 0L, 0L, 0L, 0L,
610282312L, <br>
508090709L, 0L, 0L, 0L, 0L), .Dim = c(6L, 51L), .Dimnames
= list(<br>
NULL, c("sp1", "sp2", "sp3", "sp4", "sp5", "sp6",
"sp7", <br>
"sp8", "sp9", "sp10", "sp11", "sp12", "sp13", "sp14",
"sp15", <br>
"sp16", "sp17", "sp18", "sp19", "sp20", "sp21",
"sp22", "sp23", <br>
"sp24", "sp25", "sp26", "sp27", "sp28", "sp29",
"sp30", "sp31", <br>
"sp32", "sp33", "sp34", "sp35", "sp36", "sp37",
"sp38", "sp39", <br>
"sp40", "sp41", "sp42", "sp43", "sp44", "sp45",
"sp46", "sp47", <br>
"sp48", "sp49", "sp50", "sp51")))<br>
<br>
<br>
<br>
<br>
<br>
<div>Em 08-04-2014 18:37, Rodrigo Coster escreveu:<br>
</div>
<div>
<div>
<blockquote type="cite">
<div dir="ltr">Sem saber como são os teus dados fica
complicado a gente de dar um comando que
certamente funcionará... da um dput(head(dados)) e
nos envia o que aparecer na tela</div>
<div class="gmail_extra"><br>
<br>
<div class="gmail_quote"> 2014-04-08 18:34
GMT-03:00 Daniel C Bezerra <span dir="ltr"><<a href="mailto:danielcbezerra@gmail.com" target="_blank">danielcbezerra@gmail.com</a>></span>:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div dir="ltr">apply(nomedobanco,2,sum)<br>
</div>
<div class="gmail_extra"><br>
<br>
<div class="gmail_quote">2014-04-08 18:07
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>
<div>
<div bgcolor="#FFFFFF" text="#000000"> Olá pessoal!<br>
<br>
Tenho uma base de dados com 216
observações de 10 variáveis. Sendo
que essas observações são mensais,
mas tenho que trabalhar com o
total anual.<br>
<br>
Ou seja, eu tenho dados para os
meses de 1997, 1998, 1999, 2000,
..., 2014. Mas quero os totais
desses anos em cada coluna.<br>
<br>
Alguém saberia como fazer isso?<br>
<br>
<br>
<br>
Desde já muito obrigado!<span><font color="#888888"><br>
<br>
<br>
<br>
<div>-- <br>
<font size="1"><b>Alexandre
Rodrigues Loures</b><br>
</font></div>
</font></span></div>
<br>
</div>
</div>
_______________________________________________<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">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>
<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">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>
<br>
<fieldset></fieldset>
<br>
<pre>_______________________________________________
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>
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>
</div>
<span><font color="#888888">
<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" 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">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>
<br>
<fieldset></fieldset>
<br>
<pre>_______________________________________________
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>
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></div><span class="HOEnZb"><font color="#888888"><div>-- <br>
<font size="1"><b>Alexandre Rodrigues Loures</b><br>
Doutorando em Economia Aplicada<br>
Universidade Federal da Paraíba - UFPB<br>
Centro de Ciências Sociais Aplicadas - CCSA<br>
Programa de Pós-Graduação em Economia - PPGE<br>
Tel.: +55 32 9102-0690 (MG) ou +55 83 9804-1000 (PB)<br>
e-Mail: <a href="mailto:alexandre.loures@ymail.com" target="_blank">alexandre.loures@ymail.com</a><br>
Site: <a href="http://www.ccsa.ufpb.br/ppge" target="_blank">www.ccsa.ufpb.br/ppge</a></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>