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]]
_______________________________________________ [email protected] mailing list https://stat.ethz.ch/mailman/listinfo/r-sig-teaching
