Created
February 16, 2014 11:12
-
-
Save jtrecenti/9032612 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require(dplyr) | |
require(ggplot2) | |
# http://atlasbrasil.org.br/2013/dadosbrutos/atlas2013_dados_brutos.xls | |
# Salve em csv ou use o pacote gdata | |
dados <- read.csv2('atlas2013_dados_brutos.csv', as.is=T) | |
bd <- select(dados, ANO, pesotot, Município, IDHM, UFN, RDPC) %.% | |
filter(ANO==2010) %.% | |
arrange(desc(pesotot)) %.% | |
mutate(porc_acu = cumsum(pesotot), | |
porc_prop = porc_acu / sum(pesotot), | |
id_prop=1:nrow(bd) / nrow(bd)) | |
ggplot(bd, aes(x=id_prop, y=porc_prop)) + | |
geom_line() + | |
geom_point() + | |
scale_x_continuous(breaks=0:10*10/100, limits=c(0,1), labels=percent) + | |
scale_y_continuous(breaks=0:10*10/100, limits=c(0,1), labels=percent) + | |
labs(x='Percentual de municípios', y='Percentual to total da população') + | |
geom_text(data=head(bd,10), aes(x=id_prop, y=porc_prop, label=toupper(Município)), hjust=0, size=3) + | |
theme_bw() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment