[RsR] Vote Concentration Equation

Daniel dm@||v @end|ng |rom gm@||@com
Fri Apr 23 06:24:05 CEST 2010


Hello all,
I'm just a beginner on R issue, but improving.

Does anyone knows how can I get vote concentration to each ID by city
(CIDADE) considering each UF (State), because my data is long and has all
states together and IDs repeating across states.
I also tried to get  totals and then apply for division, but R din't allow
me to attach new column with less rows, of course.
So, someone have any light for me do that? Can I print values all without my
pain programing?

total.UF <- tapply(senador$Votos, senador$UF, sum)
total.MUN <- tapply(senador$Votos, senador$CODMUNIC09, sum)

z <- cbind(senador, total.UF)
Error in data.frame(..., check.names = FALSE) :
  arguments imply differing number of rows: 54861, 27

========= my data look likes these ===========

 ID         UF     CIDADE       VOTOS
1515      SP    S��o Paulo       15
1515      SP    Campinas       100
1515      SP    Santos             0
1212      SP    S��o Paulo      1500
1212      SP     Piracicaba      20
1212     SP      Campinas      300
1200     SP       Limeira          0
1200      SP     S��o Paulo     2500
1212      RJ    Rio de Janeiro 500
1212      RJ      Niteroi           20
1212     PR      Maring��       300
1200     DF      Bras��lia          10
1200     PR     Curitiba       2000


-- 
Daniel Marcelino
15�� 48' 00" S 47�� 51' 50" O
http://ow.ly/FY8T

	[[alternative HTML version deleted]]




More information about the R-SIG-Robust mailing list