[prev in list] [next in list] [prev in thread] [next in thread] 

List:       r-sig-robust
Subject:    [RsR] Vote Concentration Equation
From:       Daniel <dmsilv () gmail ! com>
Date:       2010-04-23 4:24:05
Message-ID: u2q4358fd1a1004222124p2171450fwd62fa325531ab18 () mail ! gmail ! com
[Download RAW message or body]

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]]



_______________________________________________
R-SIG-Robust@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-sig-robust


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic