<html xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40"><head><meta http-equiv=Content-Type content="text/html; charset=utf-8"><meta name=Generator content="Microsoft Word 15 (filtered medium)"><style><!--
/* Font Definitions */
@font-face
{font-family:Helvetica;
panose-1:2 11 5 4 2 2 2 2 2 4;}
@font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0cm;
margin-bottom:.0001pt;
font-size:11.0pt;
font-family:"Calibri",sans-serif;}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:blue;
text-decoration:underline;}
.MsoChpDefault
{mso-style-type:export-only;}
@page WordSection1
{size:612.0pt 792.0pt;
margin:70.85pt 3.0cm 70.85pt 3.0cm;}
div.WordSection1
{page:WordSection1;}
--></style></head><body lang=PT-BR link=blue vlink="#954F72"><div class=WordSection1><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>Prezados e Prezadas,</p><p class=MsoNormal><o:p> </o:p></p><p style='mso-margin-top-alt:0cm;margin-right:0cm;margin-bottom:7.9pt;margin-left:0cm;background:white'><span style='font-size:10.0pt;font-family:"Helvetica",sans-serif;color:#29303B'>Estou trabalhando com o IVS (Índice de Vulnerabilidade Social), mais precisamente com as UDHs (Unidades de Habitação) para o Município de Jaboatão dos Guararapes - PE. A base Completa + Shapefiles estão no site do Ipea (<a href="http://ivs.ipea.gov.br/index.php/pt/biblioteca" target="_blank"><span style='color:#007791;text-decoration:none'>http://ivs.ipea.gov.br/index.php/pt/biblioteca</span></a>). Gostaria de fazer um mapa do Índice de Vulnerabilidade Social do Município para saber quais as localidades mais vulneráveis.<o:p></o:p></span></p><p style='mso-margin-top-alt:0cm;margin-right:0cm;margin-bottom:7.9pt;margin-left:0cm;background:white;box-sizing: border-box;font-variant-ligatures: normal;font-variant-caps: normal;orphans: 2;text-align:start;widows: 2;-webkit-text-stroke-width: 0px;text-decoration-style: initial;text-decoration-color: initial;word-spacing:0px'><span style='font-size:10.0pt;font-family:"Helvetica",sans-serif;color:#29303B'>Tentei unir pelo código do município e pela variável UDH_Atlas no shapefile e udh e travei.<o:p></o:p></span></p><p style='mso-margin-top-alt:0cm;margin-right:0cm;margin-bottom:7.9pt;margin-left:0cm;background:white;box-sizing: border-box;font-variant-ligatures: normal;font-variant-caps: normal;orphans: 2;text-align:start;widows: 2;-webkit-text-stroke-width: 0px;text-decoration-style: initial;text-decoration-color: initial;word-spacing:0px'><span style='font-size:10.0pt;font-family:"Helvetica",sans-serif;color:#29303B'>Ao que parece:<o:p></o:p></span></p><p style='mso-margin-top-alt:0cm;margin-right:0cm;margin-bottom:7.9pt;margin-left:0cm;background:white;box-sizing: border-box;font-variant-ligatures: normal;font-variant-caps: normal;orphans: 2;text-align:start;widows: 2;-webkit-text-stroke-width: 0px;text-decoration-style: initial;text-decoration-color: initial;word-spacing:0px'><span style='font-size:10.0pt;font-family:"Helvetica",sans-serif;color:#29303B'>1. UDHs são colocados como "strings" pelo R, ao colocar a função as.numeric(), há uma mudança nas linhas.<o:p></o:p></span></p><p style='mso-margin-top-alt:0cm;margin-right:0cm;margin-bottom:7.9pt;margin-left:0cm;background:white;box-sizing: border-box;font-variant-ligatures: normal;font-variant-caps: normal;orphans: 2;text-align:start;widows: 2;-webkit-text-stroke-width: 0px;text-decoration-style: initial;text-decoration-color: initial;word-spacing:0px'><span style='font-size:10.0pt;font-family:"Helvetica",sans-serif;color:#29303B'>2. UDHs são coordenadas únicas (não se separam em Long. e Lat.), ou temos que separá-las em Long e Lat?<o:p></o:p></span></p><p style='mso-margin-top-alt:0cm;margin-right:0cm;margin-bottom:7.9pt;margin-left:0cm;background:white'><span style='font-size:10.0pt;font-family:"Helvetica",sans-serif;color:#29303B'><o:p> </o:p></span></p><p style='mso-margin-top-alt:0cm;margin-right:0cm;margin-bottom:7.9pt;margin-left:0cm;background:white'><span style='font-size:10.0pt;font-family:"Helvetica",sans-serif;color:#29303B'>Agradeço desde já a ajuda,<o:p></o:p></span></p><p style='mso-margin-top-alt:0cm;margin-right:0cm;margin-bottom:7.9pt;margin-left:0cm;background:white'><span style='font-size:10.0pt;font-family:"Helvetica",sans-serif;color:#29303B'><o:p> </o:p></span></p><p style='mso-margin-top-alt:0cm;margin-right:0cm;margin-bottom:7.9pt;margin-left:0cm;background:white'><span style='font-size:10.0pt;font-family:"Helvetica",sans-serif;color:#29303B'>Marcelo Nery Magalhães<o:p></o:p></span></p><p style='mso-margin-top-alt:0cm;margin-right:0cm;margin-bottom:7.9pt;margin-left:0cm;background:white'><span style='font-size:10.0pt;font-family:"Helvetica",sans-serif;color:#29303B'><o:p> </o:p></span></p><p style='mso-margin-top-alt:0cm;margin-right:0cm;margin-bottom:7.9pt;margin-left:0cm;background:white'><span style='font-size:10.0pt;font-family:"Helvetica",sans-serif;color:#29303B'>Script:<o:p></o:p></span></p><p style='background:white'><span style='font-size:10.0pt;font-family:"Helvetica",sans-serif;color:#29303B'>#Bibliotecas<o:p></o:p></span></p><p style='background:white'><span style='font-size:10.0pt;font-family:"Helvetica",sans-serif;color:#29303B'>library(ggplot2)<o:p></o:p></span></p><p style='background:white'><span style='font-size:10.0pt;font-family:"Helvetica",sans-serif;color:#29303B'>library(rgdal)<o:p></o:p></span></p><p style='background:white'><span style='font-size:10.0pt;font-family:"Helvetica",sans-serif;color:#29303B'><o:p> </o:p></span></p><p style='background:white'><span style='font-size:10.0pt;font-family:"Helvetica",sans-serif;color:#29303B'>#Shape<o:p></o:p></span></p><p style='background:white'><span style='font-size:10.0pt;font-family:"Helvetica",sans-serif;color:#29303B'>Jab<-readOGR("C:/Users/usuario/Documents/IVS", "UDHs_RM_Todas")<o:p></o:p></span></p><p style='background:white'><span style='font-size:10.0pt;font-family:"Helvetica",sans-serif;color:#29303B'>head(Jab@data)<o:p></o:p></span></p><p style='background:white'><span style='font-size:10.0pt;font-family:"Helvetica",sans-serif;color:#29303B'><o:p> </o:p></span></p><p style='background:white'><span style='font-size:10.0pt;font-family:"Helvetica",sans-serif;color:#29303B'>#Transformando string em numérico<o:p></o:p></span></p><p style='background:white'><span style='font-size:10.0pt;font-family:"Helvetica",sans-serif;color:#29303B'>Jab$UDH_ATLAS<-as.numeric(Jab$UDH_ATLAS)<o:p></o:p></span></p><p style='background:white'><span style='font-size:10.0pt;font-family:"Helvetica",sans-serif;color:#29303B'><o:p> </o:p></span></p><p style='background:white'><span style='font-size:10.0pt;font-family:"Helvetica",sans-serif;color:#29303B'>#Base de dados/tabela<o:p></o:p></span></p><p style='background:white'><span style='font-size:10.0pt;font-family:"Helvetica",sans-serif;color:#29303B'>ivs<-read.csv("C:/Users/usuario/Documents/IVS/jab.csv", sep = ";", head=T, dec = ",")<o:p></o:p></span></p><p style='background:white'><span style='font-size:10.0pt;font-family:"Helvetica",sans-serif;color:#29303B'>head(ivs)<o:p></o:p></span></p><p style='background:white'><span style='font-size:10.0pt;font-family:"Helvetica",sans-serif;color:#29303B'><o:p> </o:p></span></p><p style='background:white'><span style='font-size:10.0pt;font-family:"Helvetica",sans-serif;color:#29303B'>ivs<-na.omit(ivs)<o:p></o:p></span></p><p style='background:white'><span style='font-size:10.0pt;font-family:"Helvetica",sans-serif;color:#29303B'><o:p> </o:p></span></p><p style='background:white'><span style='font-size:10.0pt;font-family:"Helvetica",sans-serif;color:#29303B'>names(Jab@data)<o:p></o:p></span></p><p style='background:white'><span style='font-size:10.0pt;font-family:"Helvetica",sans-serif;color:#29303B'>names(ivs)<o:p></o:p></span></p><p style='background:white'><span style='font-size:10.0pt;font-family:"Helvetica",sans-serif;color:#29303B'><o:p> </o:p></span></p><p style='background:white'><span style='font-size:10.0pt;font-family:"Helvetica",sans-serif;color:#29303B'>#Transformando os nomes das variáveis em um só para cada objeto<o:p></o:p></span></p><p style='background:white'><span style='font-size:10.0pt;font-family:"Helvetica",sans-serif;color:#29303B'>names(ivs)[12]<-c("Cod_mun_6")<o:p></o:p></span></p><p style='background:white'><span style='font-size:10.0pt;font-family:"Helvetica",sans-serif;color:#29303B'>names(Jab)[1]<-c("udh") # tentei criar uma chave com essa variável, já que com o código do município não estava funcionando<o:p></o:p></span></p><p style='background:white'><span style='font-size:10.0pt;font-family:"Helvetica",sans-serif;color:#29303B'>names(Jab)<o:p></o:p></span></p><p style='background:white'><span style='font-size:10.0pt;font-family:"Helvetica",sans-serif;color:#29303B'>names(ivs)<o:p></o:p></span></p><p style='background:white'><span style='font-size:10.0pt;font-family:"Helvetica",sans-serif;color:#29303B'><o:p> </o:p></span></p><p style='background:white'><span style='font-size:10.0pt;font-family:"Helvetica",sans-serif;color:#29303B'>#Ordenando<o:p></o:p></span></p><p style='background:white'><span style='font-size:10.0pt;font-family:"Helvetica",sans-serif;color:#29303B'>ivs<-ivs[order(ivs$Cod_mun_6),]<o:p></o:p></span></p><p style='background:white'><span style='font-size:10.0pt;font-family:"Helvetica",sans-serif;color:#29303B'>Jab<-Jab@data[order(Jab$Cod_mun_6),]<o:p></o:p></span></p><p style='background:white'><span style='font-size:10.0pt;font-family:"Helvetica",sans-serif;color:#29303B'><o:p> </o:p></span></p><p style='background:white'><span style='font-size:10.0pt;font-family:"Helvetica",sans-serif;color:#29303B'>head(ivs)<o:p></o:p></span></p><p style='background:white'><span style='font-size:10.0pt;font-family:"Helvetica",sans-serif;color:#29303B'>head(Jab)<o:p></o:p></span></p><p style='background:white'><span style='font-size:10.0pt;font-family:"Helvetica",sans-serif;color:#29303B'><o:p> </o:p></span></p><p style='background:white'><span style='font-size:10.0pt;font-family:"Helvetica",sans-serif;color:#29303B'>#Combinando através da Chave do Código do Município<o:p></o:p></span></p><p style='background:white'><span style='font-size:10.0pt;font-family:"Helvetica",sans-serif;color:#29303B'>j<-merge(Jab,ivs,by.y="Cod_mun_6") # Houve problema ao criar “j”<o:p></o:p></span></p><p style='background:white'><span style='font-size:10.0pt;font-family:"Helvetica",sans-serif;color:#29303B'>head(j)<o:p></o:p></span></p><p style='background:white'><span style='font-size:10.0pt;font-family:"Helvetica",sans-serif;color:#29303B'><o:p> </o:p></span></p><p style='background:white'><span style='font-size:10.0pt;font-family:"Helvetica",sans-serif;color:#29303B'>dim(Jab)<o:p></o:p></span></p><p style='background:white'><span style='font-size:10.0pt;font-family:"Helvetica",sans-serif;color:#29303B'>dim(ivs)<o:p></o:p></span></p><p style='background:white'><span style='font-size:10.0pt;font-family:"Helvetica",sans-serif;color:#29303B'>dim(j)<o:p></o:p></span></p><p style='background:white'><span style='font-size:10.0pt;font-family:"Helvetica",sans-serif;color:#29303B'><o:p> </o:p></span></p><p style='background:white'><span style='font-size:10.0pt;font-family:"Helvetica",sans-serif;color:#29303B'>fortify(Jab)<o:p></o:p></span></p><p style='background:white'><span style='font-size:10.0pt;font-family:"Helvetica",sans-serif;color:#29303B'>j.f<-fortify(Jab,region="udh")<o:p></o:p></span></p><p style='background:white'><span style='font-size:10.0pt;font-family:"Helvetica",sans-serif;color:#29303B'><o:p> </o:p></span></p><p style='background:white'><span style='font-size:10.0pt;font-family:"Helvetica",sans-serif;color:#29303B'>j$ivs<o:p></o:p></span></p><p style='background:white'><span style='font-size:10.0pt;font-family:"Helvetica",sans-serif;color:#29303B'>#Categorizando<o:p></o:p></span></p><p style='background:white'><span style='font-size:10.0pt;font-family:"Helvetica",sans-serif;color:#29303B'>j$ivscat<-cut(j$ivs, breaks = c(0,0.200,0.300,0.400,0.500,1), labels=c("0 a 0,200 - Muito Baixa", "0,200 a 0,300 - Baixa", "0,300 a 0,400 - Média", "0,400 a 0,500 - Alta", "0,500 a 1 - Muito Alta"), include.lowest=T)<o:p></o:p></span></p><p style='background:white'><span style='font-size:10.0pt;font-family:"Helvetica",sans-serif;color:#29303B'>names(j)<o:p></o:p></span></p><p style='background:white'><span style='font-size:10.0pt;font-family:"Helvetica",sans-serif;color:#29303B'>names(j.f)<o:p></o:p></span></p><p style='background:white'><span style='font-size:10.0pt;font-family:"Helvetica",sans-serif;color:#29303B'>#Problema: udh não possui latitude e lobgitude (como fazer, então?)<o:p></o:p></span></p><p style='mso-margin-top-alt:0cm;margin-right:0cm;margin-bottom:7.9pt;margin-left:0cm;background:white'><span style='font-size:10.0pt;font-family:"Helvetica",sans-serif;color:#29303B'>jabo<-merge(j, j.f, by.y="udh")<o:p></o:p></span></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal><o:p> </o:p></p></div></body></html>